Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a Spring Starter with Gradle and Java 11 does not work #89

Closed
abhishek2bommakanti opened this issue Sep 27, 2018 · 14 comments
Closed

Comments

@abhishek2bommakanti
Copy link

I'm trying to create a new Spring Starter project using Gradle and Java 11. The project creation fails with the following error:

IllegalArgumentException: Could not determine java version from '11'.
java.lang.reflect.InvocationTargetException

@kdvolder
Copy link
Member

The Java 11 support for Eclipse platform is still experimental not yet included in the STS 4 build. You can try it out though, but you have to install it manually from Eclipse marketplace:

https://marketplace.eclipse.org/content/java-11-support-eclipse-photon-49

@martinlippert
Copy link
Member

The support that is available works for basic Java projects, but the Maven support (and the same applies probably to the Gradle integration for Eclipse) isn't ready for Java 11 yet. Looks like we need to wait for the next Eclipse release to get real Java 11 support across the various pieces.

@abhishek2bommakanti
Copy link
Author

Creating it as a Maven project actually works, but Gradle (my preference) does not. As you said, we will perhaps have to wait for the next Eclipse release to properly support Java 11. Are you gong to have STS4 releases to correspond to the Eclipse release cycle?

@kdvolder
Copy link
Member

I'm not sure how well it will hold up if you really use it in earnest but I just tried setting up a gradle project and it seemed to be working. Here's what I did:

  • STS 4 release
  • installed the Java Eclipse support for Java 11 from marketplace
  • Downloaded and configured Java 11 open jdk as a workspace JRE
  • Created a "New Spring Starter" project with Gradle and Java 11 selected.

A bit to my suprise the generated project didn't atually select Java 11 in the build.gradle. That is probably a bug in the 'start.spring.io' webservice (not STS). I will have to follow up with that and make sure it is reported.

I worked around this problem simply by opening build.gradle and changing the line:
sourceCompatibility = 1.8 to sourceCompatibility = 11.0. Then selected from project context menu "Gradle >> Refresh Gradle Project". After that the project looked like it was a correctly configured Java 11 / Gradle / Spring boot application.

Maybe give those steps a try and see if it works for you.

@martinlippert
Copy link
Member

You can give it a try, as Kris described, but I have the Java 11 support installed and quickly tried Maven for creating a project, but I immediately run into issues... :-(

And yes, we will push out new Spring Tools 4 releases quickly after new Eclipse releases are being released (as we did in the past with STS3). There is no exact release plan yet, but I expect us to release in even shorter release cycles than Eclipse.

@kdvolder
Copy link
Member

Looks like Martin already reported this problem for maven projects.
spring-io/initializr#739

So I just added a note about gradle also being broken.

@martinlippert
Copy link
Member

In addition to that I also run into:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=539578

@abhishek2bommakanti
Copy link
Author

@kdvolder You were correct about the version issue. I followed all your steps, but am still facing the same issue. Moreover, if I try to import the project as a Gradle project, on the import preview, I get all the home directories as unknown, due to which the import fails too.

screen shot 2018-09-27 at 11 41 07 am

@kdvolder
Copy link
Member

kdvolder commented Sep 27, 2018

Some quick feedback on the ticket we raised with spring initalizr showed us that the downgrade Java 11 -> 1.8 isn't actually a bug but done deliberately because Boot 2.0 doesn't support Java 11. So you have to make sure to select Boot 2.1 version.

That doesn't necessarily mean everything will just work if you do that, might still run into some tooling issues. But at first blush when I do this it creates a correctly configured project for me.

@abhishek2bommakanti
Copy link
Author

@kdvolder Thanks for the info. I wasn't aware of this either. I tried the 2.1.0.M4 version but am still facing the same issue where the Gradle import does not get any of the Home Directories...

@kdvolder
Copy link
Member

@abhishek2bommakanti Seems to work for me. This sounds like something about your workspace or system (environment variables?) that is confusing buildship. I have no idea what it might be. But I don't typically use Gradle so I don't have gradle on my path, or any gradle related stuff in my system environment variables. And I didn't make any changes in the Eclipse workspace preferences regarding Gradle. Pertty much the only special thing about my workspace is that I manually added a JDK 11 to it.

If you don't have a setup like that perhaps something about your setup is confusing BuildShip so it can't work out which version of Gradle to use, or which version of Java to run it with.

For comparison here's how it looks like when I use the BuildShip import wizard:

buildship-import-page-3

@kdvolder
Copy link
Member

BTW: We are not the best people to help trouble-shoot your BuildShip problem. I'm not really sure how BuildShip tries to determine the Java home, but it seems that is somehow failing for you. If you can't figure it out, perhaps the best course of action would be raise an Eclipse bugzilla ticket against BuildShip. Perhaps this is a BuildShip bug, or at the very least they might be able to help figure out why BuildShip can't figure out which version/installation of Java to use on your machine / workspace.

@abhishek2bommakanti
Copy link
Author

abhishek2bommakanti commented Sep 27, 2018 via email

@martinlippert
Copy link
Member

Thanks for cross-posting the bug reference, now lets see what happens on the buildship side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants