Maven compiler plugin issue with Java 14

Sett 346 ganger
Hopp til første uleste melding

Hector Fontanez

ulest,
14. juli 2020, 15:02:2714.07.2020
til Jenkins Users
We updated our project to Java 14 a while back. However, we forgot to update the POM so that the Maven compiler plugin would compile with Java 14. Prior to the change, we were using Java 1.8.

I updated the plugins section of my POM.xml like this:
<plugins>
   
<plugin>
       
<groupId>org.apache.maven.plugins</groupId>
       
<artifactId>maven-compiler-plugin</artifactId>
       
<version>3.8.1</version>
       
<configuration>
           
<release>14</release>
           
<compilerArgs>--enable-preview</compilerArgs>
           
<forceJavacCompilerUse>true</forceJavacCompilerUse>
           
<parameters>true</parameters>
       
</configuration>
   
</plugin>
   
<plugin>
       
<groupId>org.apache.maven.plugins</groupId>
       
<artifactId>maven-surefire-plugin</artifactId>
       
<version>3.0.0-M5</version>
       
<configuration>
           
<argLine>--enable-preview</argLine>
           
<testFailureIgnore>false</testFailureIgnore>
           
<includes/>
           
<systemPropertyVariables>
               
<environment>${myEnvironment}</environment>
           
</systemPropertyVariables>
       
</configuration>
   
</plugin>
</plugins>


When the Jenkins project starts, it cleans, compiles, but it doesn't run any tests. See line (below):
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0.

Running as SYSTEM
Building in workspace C:\Program Files (x86)\Jenkins\workspace\Ad hoc tests (manual trigger)
using credential 8c47d007-2b61-4455-8058-782db2063267
 
> C:\Program Files\Git\cmd\git.exe rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 
> C:\Program Files\Git\cmd\git.exe config remote.origin.url ssh://g...@bitbucket.org/xpressdocs/cucumber-automation.git # timeout=10
Fetching upstream changes from ssh://g...@bitbucket.org/xpressdocs/cucumber-automation.git
 
> C:\Program Files\Git\cmd\git.exe --version # timeout=10
using GIT_SSH to set credentials SSH Key To Connect to Bitbucket
 
> C:\Program Files\Git\cmd\git.exe fetch --tags --progress -- ssh://g...@bitbucket.org/xpressdocs/cucumber-automation.git +refs/heads/*:refs/remotes/origin/* # timeout=10
 
> C:\Program Files\Git\cmd\git.exe rev-parse "refs/remotes/origin/java14_maven^{commit}" # timeout=10
 
> C:\Program Files\Git\cmd\git.exe rev-parse "refs/remotes/origin/origin/java14_maven^{commit}" # timeout=10
Checking out Revision 635a14fa6bac02a4f39ef7b6da8d116a91f5a387 (refs/remotes/origin/java14_maven)
 
> C:\Program Files\Git\cmd\git.exe config core.sparsecheckout # timeout=10
 
> C:\Program Files\Git\cmd\git.exe checkout -f 635a14fa6bac02a4f39ef7b6da8d116a91f5a387 # timeout=10
Commit message: "testfailureignore=false"
 
> C:\Program Files\Git\cmd\git.exe rev-list --no-walk 635a14fa6bac02a4f39ef7b6da8d116a91f5a387 # timeout=10
[Ad hoc tests (manual trigger)] $ cmd.exe /C '""C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\Maven\bin\mvn.cmd"' clean && exit %%ERRORLEVEL%%"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building TestCucumber 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ TestCucumber ---
[INFO] Deleting C:\Program Files (x86)\Jenkins\workspace\Ad hoc tests (manual trigger)\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.375 s
[INFO] Finished at: 2020-07-14T11:15:09-05:00
[INFO] Final Memory: 6M/24M
[INFO] ------------------------------------------------------------------------
Parsing POMs
Modules changed, recalculating dependency graph
Established TCP socket on 58172
[Ad hoc tests (manual trigger)] $ "
C:\Program Files\Java\jdk-14.0.1/bin/java" -cp "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-agent-1.13.jar;C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\Maven\boot\plexus-classworlds-2.5.2.jar;C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\Maven/conf/logging" jenkins.maven3.agent.Maven35Main "C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\Maven" "C:\Program Files (x86)\Jenkins\war\WEB-INF\lib\remoting-4.2.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-interceptor-1.13.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.13.jar" 58172
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven:  -B -f C:\Program Files (x86)\Jenkins\workspace\Ad hoc tests (manual trigger)\pom.xml test -Dcucumber.options=--tags @EmailVerification features/Hector -Dbrowser=chrome -DmyEnvironment=stage
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building TestCucumber 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.sun.xml.bind:jaxb-osgi:jar:2.2.10 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ TestCucumber ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ TestCucumber ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 99 source files to C:\Program Files (x86)\Jenkins\workspace\Ad hoc tests (manual trigger)\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ TestCucumber ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Program Files (x86)\Jenkins\workspace\Ad hoc tests (manual trigger)\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ TestCucumber ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Program Files (x86)\Jenkins\workspace\Ad hoc tests (manual trigger)\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ TestCucumber ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[JENKINS] Recording test results
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.839 s
[INFO] Finished at: 2020-07-14T11:15:26-05:00
[INFO] Final Memory: 38M/130M
[INFO] ------------------------------------------------------------------------
[JENKINS] Archiving C:\Program Files (x86)\Jenkins\workspace\Ad hoc tests (manual trigger)\pom.xml to com.xd.qaa.runner/TestCucumber/0.0.1-SNAPSHOT/TestCucumber-0.0.1-SNAPSHOT.pom
channel stopped
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level C:\Program Files (x86)\Jenkins\workspace\Ad hoc tests (manual trigger)\reports to C:\Program Files (x86)\Jenkins\jobs\Ad hoc tests (manual trigger)\htmlreports\Extent_20Report
Finished: SUCCESS

However, when I change the maven-compiler-plugin information to use Java 1.8, it works fine. What am I doing wrong or missing?


Regards,
Hector
jenkins.png

Hector Fontanez

ulest,
14. juli 2020, 15:49:5614.07.2020
til Jenkins Users
I figured out the problem.... Never use an non-stable version of anything.  The surefire version <version>3.0.0-M5</version> was the culprit. I reverted this back to <version>2.X.X</version> and it is working fine now.
Svar alle
Svar til forfatter
Videresend
0 nye meldinger