codeql icon indicating copy to clipboard operation
codeql copied to clipboard

Autobuild uses very old maven and maven wrapper

Open F43nd1r opened this issue 1 year ago • 2 comments

Our project uses codeql autobuild with maven and java, with no issues in the past. However, current versions of a maven plugin (asciidoctor) requires a more recent maven version. It seem the autobuild always install this fixed ancient version of maven and maven wrapper:

[2024-02-16 08:54:31] [autobuild] [INFO] Maven Wrapper version 0.5.6 has been successfully set up for your project.
[2024-02-16 08:54:31] [autobuild] [INFO] Using Apache Maven: 3.6.3

We have maven wrapper configured in our repo for maven 3.9.6, and would expect that this is used, instead of a fixed 3.6.3.

Error log from execution
  Error: 2-16 08:56:14] [autobuild] [ERROR] Failed to execute goal org.asciidoctor:asciidoctor-maven-plugin:3.0.0:process-asciidoc (output-html) on project chaos-monkey-docs: The plugin org.asciidoctor:asciidoctor-maven-plugin:3.0.0 requires Maven version 3.8.5 -> [Help 1]
  [2024-02-16 08:56:14] [autobuild] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.asciidoctor:asciidoctor-maven-plugin:3.0.0:process-asciidoc (output-html) on project chaos-monkey-docs: The plugin org.asciidoctor:asciidoctor-maven-plugin:3.0.0 requires Maven version 3.8.5
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:172)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
  [2024-02-16 08:56:14] [autobuild]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
  [2024-02-16 08:56:14] [autobuild]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
  [2024-02-16 08:56:14] [autobuild]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
  [2024-02-16 08:56:14] [autobuild]     at java.lang.reflect.Method.invoke (Method.java:568)
  [2024-02-16 08:56:14] [autobuild]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
  [2024-02-16 08:56:14] [autobuild]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
  [2024-02-16 08:56:14] [autobuild]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
  [2024-02-16 08:56:14] [autobuild]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
  [2024-02-16 08:56:14] [autobuild]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
  [2024-02-16 08:56:14] [autobuild]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
  [2024-02-16 08:56:14] [autobuild]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
  [2024-02-16 08:56:14] [autobuild]     at java.lang.reflect.Method.invoke (Method.java:568)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61)
  [2024-02-16 08:56:14] [autobuild] Caused by: org.apache.maven.plugin.PluginIncompatibleException: The plugin org.asciidoctor:asciidoctor-maven-plugin:3.0.0 requires Maven version 3.8.5
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.plugin.internal.DefaultMavenPluginManager.checkRequiredMavenVersion (DefaultMavenPluginManager.java:309)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:168)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
  [2024-02-16 08:56:14] [autobuild]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
  [2024-02-16 08:56:14] [autobuild]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
  [2024-02-16 08:56:14] [autobuild]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
  [2024-02-16 08:56:14] [autobuild]     at java.lang.reflect.Method.invoke (Method.java:568)
  [2024-02-16 08:56:14] [autobuild]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
  [2024-02-16 08:56:14] [autobuild]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
  [2024-02-16 08:56:14] [autobuild]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
  [2024-02-16 08:56:14] [autobuild]     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
  [2024-02-16 08:56:14] [autobuild]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
  [2024-02-16 08:56:14] [autobuild]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
  [2024-02-16 08:56:14] [autobuild]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
  [2024-02-16 08:56:14] [autobuild]     at java.lang.reflect.Method.invoke (Method.java:568)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
  [2024-02-16 08:56:14] [autobuild]     at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61)
  Error: 2-16 08:56:14] [autobuild] [ERROR] 
  Error: 2-16 08:56:14] [autobuild] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  Error: 2-16 08:56:14] [autobuild] [ERROR] 
  Error: 2-16 08:56:14] [autobuild] [ERROR] For more information about the errors and possible solutions, please read the following articles:
  Error: 2-16 08:56:14] [autobuild] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginIncompatibleException
  Error: 2-16 08:56:14] [autobuild] [ERROR] 
  Error: 2-16 08:56:14] [autobuild] [ERROR] After correcting the problems, you can resume the build with the command
  Error: 2-16 08:56:14] [autobuild] [ERROR]   mvn <args> -rf :chaos-monkey-docs
  Error: 2-16 08:56:14] [ERROR] Spawned process exited abnormally (code 1; tried to run: [/home/runner/work/chaos-monkey-spring-boot/chaos-monkey-spring-boot/./mvnw, clean, package, -f, pom.xml, -B, -V, -e, -Dfindbugs.skip, -Dcheckstyle.skip, -Dpmd.skip=true, -Dspotbugs.skip, -Denforcer.skip, -Dmaven.javadoc.skip, -DskipTests, -Dmaven.test.skip.exec, -Dlicense.skip=true, -Drat.skip=true, -Dspotless.check.skip=true, -t, /home/runner/.m2/toolchains.xml])
  Error: We were unable to automatically build your code. Please replace the call to the autobuild action with your custom build steps. Encountered a fatal error while running "/opt/hostedtoolcache/CodeQL/2.16.2/x64/codeql/java/tools/autobuild.sh". Exit code was 1 and last log line was: Picked up JAVA_TOOL_OPTIONS:  -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false. See the logs for more details.

F43nd1r avatar Feb 16 '24 13:02 F43nd1r

Yes, this is reinstalling the Maven wrapper because its jar file is missing, and by default the wrapper-install action uses the version of Maven invoking it... which in this case is 3.6.3. The short-term workaround is to invoke ./mvnw --version before CodeQL's autobuild routine to download it yourself. Longer-term I'll fix this to notice that your mvnw is able to take care of that by itself.

smowton avatar Feb 16 '24 14:02 smowton

Thanks for the workaround, does the job for us.

F43nd1r avatar Feb 16 '24 15:02 F43nd1r