jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.55k stars 4.02k forks source link

Java 9 support #6391

Closed mraible closed 7 years ago

mraible commented 7 years ago
Overview of the issue

JHipster should run on Java 9, especially since it's being released tomorrow (September 21). I tried downloading the latest release from http://jdk.java.net/9/.

I updated my pom.xml to upgrade versions:

<java.version>1.9</java.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
<maven-enforcer-plugin.version>3.0.0-M1</maven-enforcer-plugin.version>

When I run mvn, I get the following error:

[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ okta ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 60 source files to /Users/mraible/okta-hipster/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.654 s
[INFO] Finished at: 2017-09-20T12:30:55-04:00
[INFO] Final Memory: 43M/142M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile 
(default-compile) on project okta: Fatal error compiling: java.lang.NoClassDefFoundError: 
javax/annotation/Generated: javax.annotation.Generated -> [Help 1]

I tried adding the following (as suggested here to the compiler plugin's configuration, but it doesn't help.

<compilerArgs>
    <arg>--add-modules</arg>
    <arg>java.xml.bind</arg>
</compilerArgs>
Motivation for or Use Case

How can JHipster be hip if it doesn't support Java 9?! ;)

PierreBesson commented 7 years ago

Sadly I think java 9 is not supported by the current Spring boot version but it seems to be in 2.0.0.BUILD-SNAPSHOT. See: https://github.com/dsyer/spring-boot-java-9

jdubois commented 7 years ago

We need to update the documentation, so that people use Java 8 (and maybe block it in Maven/Gradle?)

mraible commented 7 years ago

@PierreBesson I didn't realize it was a Spring Boot limitation, thanks for the clarification. The generator does warn you if you have Java 9 as the JAVA_HOME.

Welcome to the JHipster Generator v4.8.1
Documentation for creating an application: http://www.jhipster.tech/creating-an-app/
Application files will be generated in folder: /Users/mraible/hipster
WARNING! Java 8 is not found on your computer. Your Java version is: 9

And when you try to run it, the enforcer causes things to fail, but the error message is ugly.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce 
(enforce-versions) on project okta: Execution enforce-versions of goal 
org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce failed: An API incompatibility was 
encountered while executing org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce: 
java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-enforcer-plugin:1.4.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/mraible/.m2/repository/org/apache/maven/plugins/maven-enforcer-plugin/1.4.1/maven-enforcer-plugin-1.4.1.jar
[ERROR] urls[1] = file:/Users/mraible/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[2] = file:/Users/mraible/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar
[ERROR] urls[3] = file:/Users/mraible/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar
[ERROR] urls[4] = file:/Users/mraible/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar
[ERROR] urls[5] = file:/Users/mraible/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.jar
[ERROR] urls[6] = file:/Users/mraible/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.jar
[ERROR] urls[7] = file:/Users/mraible/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.jar
[ERROR] urls[8] = file:/Users/mraible/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
[ERROR] urls[9] = file:/Users/mraible/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[10] = file:/Users/mraible/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[11] = file:/Users/mraible/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[12] = file:/Users/mraible/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[13] = file:/Users/mraible/.m2/repository/commons-lang/commons-lang/2.3/commons-lang-2.3.jar
[ERROR] urls[14] = file:/Users/mraible/.m2/repository/org/apache/maven/enforcer/enforcer-api/1.4.1/enforcer-api-1.4.1.jar
[ERROR] urls[15] = file:/Users/mraible/.m2/repository/org/apache/maven/enforcer/enforcer-rules/1.4.1/enforcer-rules-1.4.1.jar
[ERROR] urls[16] = file:/Users/mraible/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.4/maven-common-artifact-filters-1.4.jar
[ERROR] urls[17] = file:/Users/mraible/.m2/repository/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar
[ERROR] urls[18] = file:/Users/mraible/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
[ERROR] urls[19] = file:/Users/mraible/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[20] = file:/Users/mraible/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[21] = file:/Users/mraible/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-6/plexus-i18n-1.0-beta-6.jar
[ERROR] urls[22] = file:/Users/mraible/.m2/repository/org/apache/maven/plugin-testing/maven-plugin-testing-harness/1.3/maven-plugin-testing-harness-1.3.jar
[ERROR] urls[23] = file:/Users/mraible/.m2/repository/org/codehaus/plexus/plexus-archiver/2.2/plexus-archiver-2.2.jar
[ERROR] urls[24] = file:/Users/mraible/.m2/repository/org/codehaus/plexus/plexus-io/2.0.4/plexus-io-2.0.4.jar
[ERROR] urls[25] = file:/Users/mraible/.m2/repository/junit/junit/4.11/junit-4.11.jar
[ERROR] urls[26] = file:/Users/mraible/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------

If I upgrade the enforcer plugin, it's still pretty cryptic.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.0:compile
 (default-compile) on project okta: Fatal error compiling: java.lang.NoClassDefFoundError: 
javax/annotation/Generated: javax.annotation.Generated -> [Help 1]

Upgrading the compiler plugin to 3.7.0 doesn't make this error go away.

justinedelson commented 7 years ago

javax.xml.bind is almost certainly not the correct module name for javax.annotation.Generated.

hasalex commented 7 years ago

@justinedelson You're right, javax.annotation.Generated is not in the java.xml.bind module, but in java.xml.ws.annotation. The javadoc includes the module information. See http://download.java.net/java/jdk9/docs/api/javax/annotation/Generated.html.

mraible commented 7 years ago

I got it to work with Maven, thanks to some tips from this Spring Boot ticket:

Steps to support Java 9 in JHipster:

  1. Upgrade AspectJ by adding: <aspectj.version>1.9.0.BETA-7</aspectj.version>
  2. Upgrade Java: <java.version>1.9</java.version>
  3. Upgrade Maven Compiler Plugin: <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
  4. Upgrade Maven Enforcer Plugin: <maven-enforcer-plugin.version>3.0.0-M1</maven-enforcer-plugin.version>
  5. Add JAXB as a dependency:
    <dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.2.11</version>
    </dependency>
  6. Comment out spring-boot-devtools in dev profile. Otherwise, you'll get the following error:
    Exception in thread "main" java.lang.ClassCastException: 
    java.base/jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to 
    java.base/java.net.URLClassLoader
  7. Set your MAVEN_OPTS to --add-modules java.se.ee,java.xml.bind (export MAVEN_OPTS="--add-modules java.se.ee,java.xml.bind")

I created a gist that might be easier to read for these diffs.

Maybe we should include Java 9 support as a beta feature in 4.9?!

jhipster-java9

deepu105 commented 7 years ago

I would rather have spring dev tools rather than Java 9 and wait for Spring boot upgrade so that we can do it properly. Adding Java 9 doesnt add much value to the end user at this point but spring boot devtools adds lot of value. If you need java 9 support for the conference I would suggest we do this change on a specific branch and then we can use that branch for demo

jdubois commented 7 years ago

Yes Spring Boot devtools are far more important - but @mraible do you think you could do this as a Maven profile? So people could just run ./mvnw -Pjava9 or even ./mvnw -Pprod,java9 and play with it?

mraible commented 7 years ago

I have a love/hate relationship with Spring Boot devtools. It works half the time and fails half the time. I hate when it fails on stage, which happened to me just last week. If I had a fast Linux laptop like Josh Long, I wouldn't use it. He can stop/start a Spring Boot app in just a few seconds.

I'll look into make things work with Gradle today. If I can get that to work, I can create a PR. We can tag the Java 9 choice with a beta tag and warn users that devtools doesn't work in the prompt. I might need some help modifying the Yeoman scripts to prompt for language choices.

deepu105 commented 7 years ago

I'm still not sure if it's worth offering as an Option. I would prefer to wait or to do it using the Maven profile as Julien suggested

Thanks & Regards, Deepu

On Thu, Sep 28, 2017 at 2:11 PM, Matt Raible notifications@github.com wrote:

I have a love/hate relationship with Spring Boot devtools. It works half the time and fails half the time. I hate when it fails on stage, which happened to me just last week. If I had a fast Linux laptop like Josh Long, I wouldn't use it. He can stop/start a Spring Boot app in just a few seconds.

I'll look into make things work with Gradle today. If I can get that to work, I can create a PR. We can tag the Java 9 choice with a beta tag and warn users that devtools doesn't work in the prompt. I might need some help modifying the Yeoman scripts to prompt for language choices.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jhipster/generator-jhipster/issues/6391#issuecomment-332817156, or mute the thread https://github.com/notifications/unsubscribe-auth/ABDlF4qWbqgG_B-qADr_0OZd6BRKvZ1xks5sm4z0gaJpZM4PeKBH .

cbornet commented 7 years ago

Since Spring 5 just went GA, I guess we should not have to wait too long for SB2 !

mraible commented 7 years ago

I've updated my gist for Java 9 to include Gradle. However, it requires changing three files rather than one, so not sure it can be done in a profile.

agoncal commented 7 years ago

I wouldn't mind having a "beta support" for Java 9 as I'll be starting a brand new JHipster project in a couple of weeks and want to be hype with Java 9 ;o)

Spring 5 is out and supports it, and Spring Boot 2.0 is on its way (https://github.com/jhipster/generator-jhipster/pull/6274#issuecomment-323970296). Maybe a beta support could also give some feedback on the coming Spring upgrades.

jdubois commented 7 years ago

We could start with just Maven, as this is just for beta testing: we could have a specific "java9" Maven profile, that we release with the next version, so that people can test without too much issue. That would be great for testing.

On Thu, Sep 28, 2017 at 6:46 PM, Antonio Goncalves <notifications@github.com

wrote:

I wouldn't mind having a "beta support" for Java 9 as I'll be starting a brand new JHipster project in a couple of weeks and want to be hype with Java 9 ;o)

Spring 5 is out and supports it, and Spring Boot 2.0 is on its way (#6274 (comment) https://github.com/jhipster/generator-jhipster/pull/6274#issuecomment-323970296). Maybe a beta support could also give some feedback on the coming Spring upgrades.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jhipster/generator-jhipster/issues/6391#issuecomment-332895852, or mute the thread https://github.com/notifications/unsubscribe-auth/AATVo3N-bTgeYHIAowckAM2qgPYFki-eks5sm81lgaJpZM4PeKBH .

-- Julien Dubois

Twitter: @juliendubois http://twitter.com/#!/juliendubois

mraible commented 7 years ago

I tried creating a java9 profile in a Maven project.

<profile>
    <id>java9</id>
    <properties>
        <aspectj.version>1.9.0.BETA-7</aspectj.version>
        <java.version>1.9</java.version>
        <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
        <maven-enforcer-plugin.version>3.0.0-M1</maven-enforcer-plugin.version>
    </properties>
    <dependencies>
        <!-- JAXB for Java 9 -->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.11</version>
        </dependency>
    </dependencies>
</profile>

However, when I run it with mvn -Pjava9, it fails with a stack trace that doesn't seem to indicate what is wrong.

[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ ojo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 60 source files to /Users/mraible/ojo/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.137 s
[INFO] Finished at: 2017-09-29T07:52:04-07:00
[INFO] Final Memory: 41M/136M
[INFO] ------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/usr/local/Cellar/maven/3.5.0/libexec/conf/logging/
constituent[1]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/aopalliance-1.0.jar
constituent[2]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/cdi-api-1.0.jar
constituent[3]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/commons-cli-1.4.jar
constituent[4]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/commons-io-2.5.jar
constituent[5]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/commons-lang3-3.5.jar
constituent[6]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/guava-20.0.jar
constituent[7]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/guice-4.0-no_aop.jar
constituent[8]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/jansi-1.13.jar
constituent[9]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/javax.inject-1.jar
constituent[10]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/jcl-over-slf4j-1.7.22.jar
constituent[11]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/jsr250-api-1.0.jar
constituent[12]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-artifact-3.5.0.jar
constituent[13]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-builder-support-3.5.0.jar
constituent[14]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-compat-3.5.0.jar
constituent[15]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-core-3.5.0.jar
constituent[16]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-embedder-3.5.0.jar
constituent[17]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-model-3.5.0.jar
constituent[18]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-model-builder-3.5.0.jar
constituent[19]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-plugin-api-3.5.0.jar
constituent[20]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-repository-metadata-3.5.0.jar
constituent[21]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-api-1.0.3.jar
constituent[22]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-connector-basic-1.0.3.jar
constituent[23]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-impl-1.0.3.jar
constituent[24]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-provider-3.5.0.jar
constituent[25]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-spi-1.0.3.jar
constituent[26]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-transport-wagon-1.0.3.jar
constituent[27]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-util-1.0.3.jar
constituent[28]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-settings-3.5.0.jar
constituent[29]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-settings-builder-3.5.0.jar
constituent[30]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-shared-utils-3.1.0.jar
constituent[31]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-slf4j-provider-3.5.0.jar
constituent[32]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/org.eclipse.sisu.inject-0.3.3.jar
constituent[33]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/org.eclipse.sisu.plexus-0.3.3.jar
constituent[34]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/plexus-cipher-1.7.jar
constituent[35]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/plexus-component-annotations-1.7.1.jar
constituent[36]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/plexus-interpolation-1.24.jar
constituent[37]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/plexus-sec-dispatcher-1.4.jar
constituent[38]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/plexus-utils-3.0.24.jar
constituent[39]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/slf4j-api-1.7.22.jar
constituent[40]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/wagon-file-2.12.jar
constituent[41]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/wagon-http-2.12-shaded.jar
constituent[42]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/wagon-provider-api-2.12.jar
---------------------------------------------------
Exception in thread "main" java.lang.AssertionError
    at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
    at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
    at jdk.compiler/com.sun.tools.javac.comp.Modules.enter(Modules.java:250)
    at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.readSourceFile(JavaCompiler.java:821)
    at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$ImplicitCompleter.complete(JavacProcessingEnvironment.java:1510)
    at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:633)
    at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1314)
    at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.complete(Type.java:1139)
    at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.getTypeArguments(Type.java:1065)
    at jdk.compiler/com.sun.tools.javac.code.Printer.visitClassType(Printer.java:237)
    at jdk.compiler/com.sun.tools.javac.code.Printer.visitClassType(Printer.java:52)
    at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.accept(Type.java:992)
    at jdk.compiler/com.sun.tools.javac.code.Printer.visit(Printer.java:136)
    at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:197)
    at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:165)
    at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
    at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:67)
    at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:183)
    at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:165)
    at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
    at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:67)
    at jdk.compiler/com.sun.tools.javac.util.JCDiagnostic.getMessage(JCDiagnostic.java:771)
    at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$DiagnosticSourceUnwrapper.getMessage(ClientCodeWrapper.java:799)
    at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:131)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1075)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:168)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:353)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:198)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
thiagogcm commented 7 years ago

Try this way @mraible https://github.com/spring-projects/spring-boot/commit/75dbe5c2deaa1d2df658dcceab75213b65513d8b

Btw, Spring-boot 2 will have Java 9 support in the next milestone https://github.com/spring-projects/spring-boot/issues/7226

cemo commented 7 years ago

Which Dockerfile will be used as a base file? Alpine was simple and nice in terms of size constraints but a jdk9 Alpine based is not available.

mraible commented 7 years ago

@thiagogcm I tried using the following as a profile (with an empty MAVEN_OPTS):

<profile>
    <id>java9</id>
    <activation>
        <jdk>9</jdk>
    </activation>
    <properties>
        <aspectj.version>1.9.0.BETA-7</aspectj.version>
        <java.version>1.9</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.11</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <jvmArguments>--add-modules java.xml.bind,java.xml.ws,java.xml.ws.annotation</jvmArguments>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                    <compilerArgs>
                        <arg>--add-modules</arg>
                        <arg>java.se.ee,java.xml.bind</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>--add-modules java.base,java.xml.ws</argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>
</profile>

It results in the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project ojo: Compilation failure: Compilation failure:
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/web/rest/AccountResource.java:[24,25] error: package javax.servlet.http does not exist
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/web/rest/AccountResource.java:[108,34] error: cannot find symbol
[ERROR]   symbol:   class HttpServletRequest
[ERROR]   location: class AccountResource
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/config/WebConfigurer.java:[16,18] error: package io.undertow does not exist
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/config/WebConfigurer.java:[51,26] error: cannot find symbol
[ERROR]   symbol:   class ServletContext
[ERROR]   location: class WebConfigurer
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/config/WebConfigurer.java:[51,64] error: cannot find symbol
[ERROR]   symbol:   class ServletException
[ERROR]   location: class WebConfigurer
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/config/WebConfigurer.java:[121,46] error: cannot find symbol
[ERROR]   symbol:   class ServletContext
[ERROR]   location: class WebConfigurer
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/config/WebConfigurer.java:[122,54] error: cannot find symbol
[ERROR]   symbol:   class DispatcherType
[ERROR]   location: class WebConfigurer
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/config/WebConfigurer.java:[136,29] error: cannot find symbol
[ERROR]   symbol:   class ServletContext
[ERROR]   location: class WebConfigurer
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/config/WebConfigurer.java:[136,68] error: cannot find symbol
[ERROR]   symbol:   class DispatcherType
[ERROR]   location: class WebConfigurer
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/config/WebConfigurer.java:[175,31] error: cannot find symbol
[ERROR]   symbol:   class ServletContext
[ERROR]   location: class WebConfigurer
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/config/WebConfigurer.java:[28] error: package javax.servlet does not exist
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/web/rest/errors/ExceptionTranslator.java:[20,23] error: cannot find symbol
[ERROR]   symbol:   class Nonnull
[ERROR]   location: package javax.annotation
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/web/rest/errors/ExceptionTranslator.java:[21,23] error: cannot find symbol
[ERROR]   symbol:   class Nullable
[ERROR]   location: package javax.annotation
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/web/rest/errors/ExceptionTranslator.java:[37,44] error: cannot find symbol
[ERROR]   symbol:   class Nullable
[ERROR]   location: class ExceptionTranslator
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/web/rest/errors/ExceptionTranslator.java:[69,101] error: cannot find symbol
[ERROR]   symbol:   class Nonnull
[ERROR]   location: class ExceptionTranslator
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/web/rest/errors/ExceptionTranslator.java:[90,9] error: cannot find symbol
[ERROR]   symbol:   class Nonnull
[ERROR]   location: class ExceptionTranslator
[ERROR] /Users/mraible/ojo/src/main/java/com/okta/developer/web/rest/errors/ExceptionTranslator.java:[91,9] error: cannot find symbol
[ERROR]   symbol:   class Nonnull
[ERROR]   location: class ExceptionTranslator

If I remove the compiler configuration and set MAVEN_OPTS as follows:

export MAVEN_OPTS="--add-modules java.se.ee,java.xml.bind"

It results in an error with not much information.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.580 s
[INFO] Finished at: 2017-10-01T09:33:37-06:00
[INFO] Final Memory: 41M/139M
[INFO] ------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/usr/local/Cellar/maven/3.5.0/libexec/conf/logging/
constituent[1]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/aopalliance-1.0.jar
constituent[2]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/cdi-api-1.0.jar
constituent[3]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/commons-cli-1.4.jar
constituent[4]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/commons-io-2.5.jar
constituent[5]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/commons-lang3-3.5.jar
constituent[6]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/guava-20.0.jar
constituent[7]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/guice-4.0-no_aop.jar
constituent[8]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/jansi-1.13.jar
constituent[9]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/javax.inject-1.jar
constituent[10]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/jcl-over-slf4j-1.7.22.jar
constituent[11]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/jsr250-api-1.0.jar
constituent[12]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-artifact-3.5.0.jar
constituent[13]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-builder-support-3.5.0.jar
constituent[14]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-compat-3.5.0.jar
constituent[15]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-core-3.5.0.jar
constituent[16]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-embedder-3.5.0.jar
constituent[17]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-model-3.5.0.jar
constituent[18]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-model-builder-3.5.0.jar
constituent[19]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-plugin-api-3.5.0.jar
constituent[20]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-repository-metadata-3.5.0.jar
constituent[21]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-api-1.0.3.jar
constituent[22]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-connector-basic-1.0.3.jar
constituent[23]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-impl-1.0.3.jar
constituent[24]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-provider-3.5.0.jar
constituent[25]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-spi-1.0.3.jar
constituent[26]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-transport-wagon-1.0.3.jar
constituent[27]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-resolver-util-1.0.3.jar
constituent[28]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-settings-3.5.0.jar
constituent[29]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-settings-builder-3.5.0.jar
constituent[30]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-shared-utils-3.1.0.jar
constituent[31]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/maven-slf4j-provider-3.5.0.jar
constituent[32]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/org.eclipse.sisu.inject-0.3.3.jar
constituent[33]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/org.eclipse.sisu.plexus-0.3.3.jar
constituent[34]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/plexus-cipher-1.7.jar
constituent[35]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/plexus-component-annotations-1.7.1.jar
constituent[36]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/plexus-interpolation-1.24.jar
constituent[37]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/plexus-sec-dispatcher-1.4.jar
constituent[38]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/plexus-utils-3.0.24.jar
constituent[39]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/slf4j-api-1.7.22.jar
constituent[40]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/wagon-file-2.12.jar
constituent[41]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/wagon-http-2.12-shaded.jar
constituent[42]: file:/usr/local/Cellar/maven/3.5.0/libexec/lib/wagon-provider-api-2.12.jar
---------------------------------------------------
Exception in thread "main" java.lang.AssertionError
    at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
    at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
    at jdk.compiler/com.sun.tools.javac.comp.Modules.enter(Modules.java:250)
    at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.readSourceFile(JavaCompiler.java:821)
    at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$ImplicitCompleter.complete(JavacProcessingEnvironment.java:1510)
    at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:633)
    at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1314)
    at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.complete(Type.java:1139)
    at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.getTypeArguments(Type.java:1065)
    at jdk.compiler/com.sun.tools.javac.code.Printer.visitClassType(Printer.java:237)
    at jdk.compiler/com.sun.tools.javac.code.Printer.visitClassType(Printer.java:52)
    at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.accept(Type.java:992)
    at jdk.compiler/com.sun.tools.javac.code.Printer.visit(Printer.java:136)
    at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:197)
    at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:165)
    at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
    at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:67)
    at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:183)
    at jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:165)
    at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
    at jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:67)
    at jdk.compiler/com.sun.tools.javac.util.JCDiagnostic.getMessage(JCDiagnostic.java:771)
    at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$DiagnosticSourceUnwrapper.getMessage(ClientCodeWrapper.java:799)
    at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:131)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1075)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:168)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:353)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:198)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
mraible commented 7 years ago

Note that there's issues with the war plugin and gatling too.

jdubois commented 7 years ago

Thanks @mraible - I got it working using your profile!!! For me it's definitely faster, at least 10% at startup time, which is neat! We should have this profile, only for Maven and clearly marked BETA, with our next release, so that people can test this out. If it works fine, at some point we can definitely switch to it.

mraible commented 7 years ago

Are you sure it's using the profile? Make sure your JAVA_HOME points to Java 9 since that's what Maven uses. It doesn't work for me.

On Oct 2, 2017, at 06:31, Julien Dubois notifications@github.com wrote:

Thanks @mraible - I got it working using your profile!!! For me it's definitely faster, at least 10% at startup time, which is neat! We should have this profile, only for Maven and clearly marked BETA, with our next release, so that people can test this out. If it works fine, at some point we can definitely switch to it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

jdubois commented 7 years ago

Yes I'm sure - I did a few tweaks, but the most important part is that I select that profile in Intellij IDEA (in the Maven panel), but I run the application from the "Run..." menu, selecting JDK 9 there. So it's configured by Maven, but it is run as an executable Spring Boot class by Intellij.

mraible commented 7 years ago

Are you able to package it too? I was unable to do that.

On Oct 2, 2017, at 08:35, Julien Dubois notifications@github.com wrote:

Yes I'm sure - I did a few tweaks, but the most important part is that I select that profile in Intellij IDEA (in the Maven panel), but I run the application from the "Run..." menu, selecting JDK 9 there. So it's configured by Maven, but it is run as an executable Spring Boot class by Intellij.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

jdubois commented 7 years ago

No, but I only have one error, which doesn't look too bad:


rest/errors/ExceptionTranslator.java:[20,23] error: cannot find symbol
  symbol:   class Nonnull
  location: package javax.annotation
mraible commented 7 years ago

@jdubois That's the same error I got when trying to use a profile.

mraible commented 7 years ago

See Nicolas Fränkel's blog post for information on making Spring Boot 1.5.x work with Java 9. Since Spring Boot 2.0 will officially support Java 9, I'm closing this in favor of https://github.com/jhipster/generator-jhipster/pull/6274.

pitometsyurii commented 6 years ago

Is there any progress to support java 9? Just asking.....

cbornet commented 6 years ago

We need to wait for Spring Boot 2 which due date is currently end of February

rampantlion103 commented 6 years ago

How about now if there any support for java 9 or 10?

jdubois commented 6 years ago

It already works for both, but we did a Twitter poll and users voted against having those by default, as the Docker image is much bigger, they are not LTS releases, and they don't provide much added value (perf is basically the same)

rampantlion103 commented 6 years ago

Got it. I guess the next question if it can support java 11?

agilob commented 6 years ago

@rampantlion103 I just migrated my project generated in November 2017 to Java 9.

You need the following changes:

  1. In the main build.gradle file add this dependency: // dependencies for >java8 compatibility compile 'javax.xml.bind:jaxb-api:2.3.0'

  2. Go to gradle.properties and upgrade spring boot version to at least spring_boot_version=2.0.1.RELEASE and hibernate to the latest version hibernate_version=5.2.16.Final

  3. In the main build.gradle file upgrade plugin to version: id "io.spring.dependency-management" version "1.0.5.RELEASE"

  4. In the main build.gradle remove bootPackage and replace with:

bootWar {
   mainClassName = 'net.agilob.tv.YourMainClass'
}

bootJar {
    mainClassName = 'net.agilob.tv.YourMainClass'
}

In springBoot secion change mainClass to mainClassName:

springBoot {
    mainClassName = 'net.agilob.tv.YourMainClass'
    buildInfo()
}

Below in the else block leave bootRun secion empty:

} else {
    bootRun {
    }
}
  1. In gradle/profile_dev.gradle remove dependency org.springframework.boot:spring-boot-devtools as it breaks app startup (comment out for now).

  2. Go to gradle/mapstruct.gradle and add there apt dependencies:

    apt 'javax.xml.bind:jaxb-api:2.3.0'
    apt 'javax.annotation:javax.annotation-api:1.3.2'
  1. Upgrade gradle wrapper to at least 4.5.1, I have the latest version 4.7 at the time of writing this.
gmarziou commented 6 years ago

I tried JH 5 beta on JDK 8, 9 and 10 with maven and it worked.

@agilob could you try to generate a gradle project with JH5 and verify that all your points are covered?

agilob commented 6 years ago

How can I install JH5? I just run yarn global upgrade and it found 1.4.4 as the latest version.

Edit: I run jhipster upgrade on JH 1.4.4 and it as always completely broke my project, I have 165 files with git conflicts, so it looks like I won't be able to test upgrade using JH5, it adds too much manual work.

we did a Twitter poll and users voted against having those by default, as the Docker image is much bigger, they are not LTS releases, and they don't provide much added value (perf is basically the same)

I can partially agree with this, but most voters probably dont realise how much every-day stuff became deprecated and requires manual intervention after upgrade to java9 or 10. If you have a project that's older than a year, you will have a bad time trying to upgrade it, with JH or without. In the project I work on, there is a class using sun.nio.cs.StreamDecoder, that's deprecated, manual action to change compiler flags was required. Popular in JEE/Spring @PostConstruct - deprecated again. JPA meta model generation is not usable out of box yet, has to be linked against JAXB manually. Older guava versions throw runtime error about some reflect C code... And this is only beginning of a small after-hours project I work on. I decided to keep things up-to-date as much as I can and update things when it becomes possible to. Today I decided to upgrade Java version because I had to access HTTPS/WSS resource that's available only on TLS1.2, using the code in Java8 threw me 403, Java10 works fine. :+1:

If you're planning to migrate from Java7-8 to 10-11, (once Java8 is enterprise only) you should start planning it ahead, and move to J10 before.

gmarziou commented 6 years ago

Sorry @agilob for the trouble.

I should have said that the easiest would have been to look at sample project: https://github.com/jhipster/jhipster-sample-app-gradle

Otherwise, see https://www.jhipster.tech/2018/04/03/jhipster-release-5.0.0-beta.0.html : yarn global add generator-jhipster@beta

The upgrade generator does not work as-is from 4 to 5 due to npm beta channel, to work around it I had to edit one line which I don't recommend. This will work once we get out of beta.

I'm surprised by all the conflicts you had with upgrading but not sure of which version you started from (you said 1.4.4) because current version is 4.14.3

agilob commented 6 years ago

I'm surprised by all the conflicts you had with upgrading but not sure of which version you started from (you said 1.4.4) because current version is 4.14.3

I tried jhipster upgrade a couple of times before on different projects and each time I got tonnes of conflicts that it wasn't even worth investigating that. I think it's much faster and comfortable to do it step by step manually than solve conflicts generated by jhipster upgrade. This is due to JH being very strongly opinionated, eg. I dont use liquibase, I dont need 75% of generated tests on entities (I need only POST and GET endpoints), a lot of changes in repositories, services and query service, changes to mappers - all of these are removed or overridden by upgrade process. Say, we dont have http delete endpoints (and tests) for entity X, but we realise we need to add new filed on that entity. We get conflicts on liquibase, entity, DTO, mapper, repository, service, serviceImpl and all related tests, deleted files like dialog-delete-component in TS are restored. I see no reason why such files are restored during upgrade process or when adding new filed on existing model. After a few weeks with JH we started fighting the tools, instead using them and I have similar experiences from upgrade process.

I think I started with 4.13.1

gmarziou commented 6 years ago

This is really strange, do you remember if you pushed jhipster_upgrade branch to your git server after first upgrade?

agilob commented 6 years ago

I have this branch locally, as you can see, I tried upgrading a few times, each time I ended up doing git merge --abort

screenshot_20180424_172558

gmarziou commented 6 years ago

OK, I'll do more tests in few weeks. Maybe there's a problem with the git merge strategy used by the upgrade generator.

agilob commented 6 years ago

@agilob could you try to generate a gradle project with JH5 and verify that all your points are covered?

Looks like everything is ok with the new JH5 (beta), I just had a few more changes due to my setup, I needed a task bootJar you don't for plain JH.

agilob commented 6 years ago

Actually, I started a project generated by JH5 and it doesnt start with > java 8, it's missing some dependencies:

* What went wrong:
Execution failed for task ':compileJava'.
> java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

I assume you do not want to run it with java 9 or 10, as there is still this assert check in gradle.build: assert System.properties['java.specification.version'] == '1.8'.

but just in case, if you want to make it J9 or J10 ready just apply step 1 and 6 (also you need to upgrade docker images from 8 to 10.

gmarziou commented 6 years ago

@agilob I had a quick run on JDK 10, I removed the assertion on java 1.8 from build.gradle, I applied step 1 but could not apply step 6 as gradle/mapstruct.gradle does not exist.

My build still fails:

> gradlew

> Task :compileJava FAILED
Note: Hibernate JPA 2 Static-Metamodel Generator 5.2.16.Final

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
4 actionable tasks: 3 executed, 1 up-to-date
PierreBesson commented 6 years ago

As I thought when first seeing the error message this seems to be linked to the removal or JAXB from java 9 onward : https://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j

gmarziou commented 6 years ago

Yes indeed but it was supposed to be fixed by step 1.

@agilob instructions are correct but they were made for an older version of JH, now the annotation processor classpath is handled differently, I fixed it this way:

compile 'javax.xml.bind:jaxb-api:2.3.0'
annotationProcessor 'javax.xml.bind:jaxb-api:2.3.0'
annotationProcessor 'javax.annotation:javax.annotation-api:1.3.2'

And now build fails with an NPE:

> Task :compileJava FAILED                                    
Note: Hibernate JPA 2 Static-Metamodel Generator 5.2.16.Final

FAILURE: Build failed with an exception.

* What went wrong:                                            
Execution failed for task ':compileJava'.                     
> java.lang.NullPointerException                              
gmarziou commented 6 years ago

I am also wondering how we are going to handle JDK 8 and 9+ if build configurations are so different ? Should it be a question at project generation time or should it be done dynamically at build time?

agilob commented 6 years ago

instructions are correct but they were made for an older version of JH

@gmarziou yes, that's correct, my steps were supposed to help with manual upgrade for people trying to do it now - not waiting for JH to support it.

mraible commented 6 years ago

That’s cool to hear that everything works with Maven! Last time I tried[1], it didn’t work.

I think the icing on the JHipster 5 release would be Java 10 support!

[1] https://gist.github.com/mraible/716f4d2ab205c0e747d51119fc5d9cd8

On Apr 24, 2018, at 05:09, Gaël Marziou notifications@github.com wrote:

I tried JH 5 beta on JDK 8, 9 and 10 with maven and it worked.

@agilob could you try to generate a gradle project with JH5 and verified that all you points are covered?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

deepu105 commented 6 years ago

May be we can follow the same approach taken for node. Support latest stable/lts version by default and may be provide a flag to fallback to jdk8 as a special case since many people would still be using it?

On Fri, 27 Apr 2018, 6:43 pm Matt Raible, notifications@github.com wrote:

That’s cool to hear that everything works with Maven! Last time I tried[1], it didn’t work.

I think the icing on the JHipster 5 release would be Java 10 support!

[1] https://gist.github.com/mraible/716f4d2ab205c0e747d51119fc5d9cd8

On Apr 24, 2018, at 05:09, Gaël Marziou notifications@github.com wrote:

I tried JH 5 beta on JDK 8, 9 and 10 with maven and it worked.

@agilob could you try to generate a gradle project with JH5 and verified that all you points are covered?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jhipster/generator-jhipster/issues/6391#issuecomment-385025992, or mute the thread https://github.com/notifications/unsubscribe-auth/ABDlFyeJaEN5-LnwUeI1UVAsSMQejFaIks5ts0qogaJpZM4PeKBH .