8thlight / cob_spec

A fitnesse suite for a web server
24 stars 33 forks source link

Make cob_spec Java 9-compatible #69

Closed trptcolin closed 6 years ago

trptcolin commented 6 years ago

From a user-facing perspective, the main change is that instead of mvn package to build cob_spec fixtures, you'd use mvn clean compile assembly:single (this is covered in a README update).

trptcolin commented 6 years ago

For anyone who wants to code-review, the not-auto-generated stuff is a lot less than the 754 total files changed:

[colin:cob_spec] [java-9] $ git diff --name-only 27f1170b035f05c4d1a0fabd4b7d164870d01c83 HEAD | grep -v "FitNesseRoot/FitNesse/" | grep -v "FitNesseRoot/TemplateLibrary" | wc -l
      12
[colin:cob_spec] [java-9] $ git diff --name-only 27f1170b035f05c4d1a0fabd4b7d164870d01c83 HEAD | wc -l
     754
scottyplunkett commented 6 years ago

Getting some compilation errors...

VERSION CHECK ~/Desktop/cobspec2/cob_spec(java-9) $ java -version gives me: OUTPUT:

java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)

ATTEMPTED COMPILATION WITH: ~/Desktop/cobspec2/cob_spec(java-9) $ mvn clean compile assembly:single OUTPUT

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Fixtures 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Fixtures ---
[INFO] Deleting /Users/scottplunkett/Desktop/cobspec2/cob_spec/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Fixtures ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/scottplunkett/Desktop/cobspec2/cob_spec/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Fixtures ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to /Users/scottplunkett/Desktop/cobspec2/cob_spec/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Source option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.048 s
[INFO] Finished at: 2018-04-24T15:40:43-05:00
[INFO] Final Memory: 10M/35M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Fixtures: Compilation failure: Compilation failure:
[ERROR] Source option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
scottplunkett@Scotts-MacBook-Pro:~/Desktop/cobspec2/cob_spec(java-9) $ mvn clean compile assembly:single -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Fixtures 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Fixtures ---
[INFO] Deleting /Users/scottplunkett/Desktop/cobspec2/cob_spec/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Fixtures ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/scottplunkett/Desktop/cobspec2/cob_spec/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Fixtures ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to /Users/scottplunkett/Desktop/cobspec2/cob_spec/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Source option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.108 s
[INFO] Finished at: 2018-04-24T15:40:58-05:00
[INFO] Final Memory: 10M/35M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Fixtures: Compilation failure: Compilation failure:
[ERROR] Source option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Fixtures: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    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:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at 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)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:858)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:129)
    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.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:955)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at 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)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
scottyplunkett commented 6 years ago

Still works on Jdk8 though: VERSION CHECK ~/Desktop/cobspec2/cob_spec(java-9) $ java -version OUTPUT:

java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)

COMPILED WITH PREVIOUS COMMAND SPECIFIED IN README:

~/Desktop/cobspec2/cob_spec(java-9) $ mvn package

OUTPUT:

~/Desktop/cobspec2/cob_spec(java-9) $ mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Fixtures 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Fixtures ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/scottplunkett/Desktop/cobspec2/cob_spec/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Fixtures ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to /Users/scottplunkett/Desktop/cobspec2/cob_spec/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Fixtures ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/scottplunkett/Desktop/cobspec2/cob_spec/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ Fixtures ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Fixtures ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ Fixtures ---
[INFO] Building jar: /Users/scottplunkett/Desktop/cobspec2/cob_spec/target/Fixtures-1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.596 s
[INFO] Finished at: 2018-04-24T15:51:24-05:00
[INFO] Final Memory: 16M/215M
[INFO] ------------------------------------------------------------------------
trptcolin commented 6 years ago

Well shoot. Thanks. I had it building in Java 9 with some changes to the pom.xml, but then removed those changes to ensure I could build w/ Java 8 too, to stay backwards-compatible... Thanks!

scottyplunkett commented 6 years ago

You're welcome!

trptcolin commented 6 years ago

@scottyplunkett OK, pinned the maven build of the cob_spec fixtures to Java 8. Could become a problem in the future if we need Java 9+ features, but seems to work for now. Just tested with:

scottyplunkett commented 6 years ago

@trptcolin Awesome!

On Tue, Apr 24, 2018 at 4:02 PM Colin Jones notifications@github.com wrote:

@scottyplunkett https://github.com/scottyplunkett OK, pinned the maven build of the cob_spec fixtures to Java 8. Could become a problem in the future if we need Java 9+ features, but seems to work for now. Just tested with:

  • Java 8 build, Java 8 run
  • Java 8 build, Java 9 run
  • Java 9 build, Java 8 run
  • Java 9 build, Java 9 run

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/8thlight/cob_spec/pull/69#issuecomment-384078886, or mute the thread https://github.com/notifications/unsubscribe-auth/AeY_LPMcMcDffanb4QxmhSwrNu5slVn_ks5tr5LugaJpZM4TiUqd .

bgerstle commented 6 years ago

Just ran into the same issue, would love for this to get merged!