Extending java.base in a project built with Maven - java

Maven 3.9.0 invalid flag --patch-module is what I get when I run mvn clean compile on my project that extends java.lang package. When I run javac --patch-module java.base=src <path-to-source> all is good.
The reason is - Maven uses com.sun.tools.javac.api.JavacTool which when parsing <compilerArgs> is using only the BASIC Option group and --patch-module is in the FILEMANAGER group. This raises an illegal flag exception during mvn clean compile.
Does anyone know how I can get it to work with Maven? I'd prefer not to make my CI pipeline using javac command line tool.
Project structure is like:
src -> main -> java -> java.lang ->
pom.xml looks like:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>${java.source.sdk}</source>
<target>${java.source.sdk}</target>
<compilerArgs>
<arg>--patch-module java.base=src</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
Maven version:
Maven home: /opt/homebrew/Cellar/maven/3.9.0/libexec
Java version: 18, vendor: Oracle Corporation, runtime: /Users/<username>/Library/Java/JavaVirtualMachines/openjdk-18/Contents/Home
Default locale: en_RS, platform encoding: UTF-8
OS name: "mac os x", version: "12.6.2", arch: "aarch64", family: "mac"
Used JDK 19 -> same result. Used Maven 3.10.1 -> same result.
Full error is:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project commons-bootstrap: Fatal error compiling: error: invalid flag: --patch-module java.base=src -> [Help 1]
Exception stacktrace:
Caused by: java.lang.IllegalArgumentException: error: invalid flag: --patch-module java.base=src
at com.sun.tools.javac.main.Arguments.reportDiag (Arguments.java:889)
at com.sun.tools.javac.main.Arguments.doProcessArgs (Arguments.java:395)
at com.sun.tools.javac.main.Arguments.processArgs (Arguments.java:347)
at com.sun.tools.javac.main.Arguments.init (Arguments.java:246)
at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:191)
at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:119)
at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:68)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:135)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:182)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1209)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:198)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
at java.lang.reflect.Method.invoke (Method.java:577)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

Related

Facing issue while running maven clean install command for my project

I'm new to Java & in a project trying to run
mvn clean install
command to build the project but facing some issue. Saw some previous solutions but didn't work for me. I've checked for Java version & maven version. They look same to me. Any idea what could be the issue?
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error:
/bin/sh: /bin/javac: No such file or directory
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.136 s
[INFO] Finished at: 2021-12-03T00:43:04+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project My_Project: Compilation failure
[ERROR] Failure executing javac, but could not parse the error:
[ERROR] /bin/sh: /bin/javac: No such file or directory
[ERROR]
[ERROR]
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project My_Project: Compilation failure
Failure executing javac, but could not parse the error:
/bin/sh: /bin/javac: No such file or directory
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
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:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
Failure executing javac, but could not parse the error:
/bin/sh: /bin/javac: No such file or directory
at org.apache.maven.plugin.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:656)
at org.apache.maven.plugin.CompilerMojo.execute (CompilerMojo.java:128)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
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:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Following are the results for java -version & mvn -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode)
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T20:36:16+05:30)
Maven home: /Users/saswal/.asdf/installs/maven/3.6.2
Java version: 11.0.6, vendor: AdoptOpenJDK, runtime: /Users/saswal/.asdf/installs/java/adoptopenjdk-11.0.6+10.1
Default locale: en_IN, platform encoding: US-ASCII
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
pom.xml looks like this
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<service-framework-java.version>1.82</service-framework-java.version>
<elasticsearch-version>7.4.2</elasticsearch-version>
<elasticsearch-common.version>8.1.1</elasticsearch-common.version>
<elasticsearch-event-common.version>3.1.9</elasticsearch-event-common.version>
<proposal-search-consumer-shared.version>2.2.36-java8-1</proposal-search-consumer-shared.version>
<logic-domain-entities.version>4.1.14.1</logic-domain-entities.version>
<common-dropwizard.version>13.0.6</common-dropwizard.version>
</properties>
<dependencies>
Thanks in advance.
please check and follow the steps in Eclipse/STS
:- Window --> Preference --> Installed JREs -->Change path of JRE to JDK(add).
then mvn clean install
change java.version>1.82 to respective version as well

NetBeans on windows works fine but on ubnutu 20.04.2 LTE it shows me that:

When I run my code with NetBans on Windows it works fine but on ubnutu 20.04.2 LTE it shows me that:
cd /home/sulayman/NetBeansProjects/Clases; JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 /snap/netbeans/41/netbeans/java/maven/bin/mvn "-Dexec.args=-classpath %classpath clases.Clases" -Dexec.executable=/usr/lib/jvm/java-11-openjdk-amd64/bin/java org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
Running NetBeans Compile On Save execution. Phase execution is skipped and output directories of dependency projects (with Compile on Save turned on) will be used instead of their jar artifacts.
Scanning for projects...
------------------------< com.mycompany:Clases >------------------------
Building Clases 1.0-SNAPSHOT
--------------------------------[ jar ]---------------------------------
--- exec-maven-plugin:3.0.0:exec (default-cli) # Clases ---
Error: Se ha producido un error de enlace al cargar la clase principal clases.Clases
java.lang.UnsupportedClassVersionError: clases/Clases has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:982)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:929)
at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:457)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
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:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1.707 s
Finished at: 2021-02-28T14:01:07+01:00
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) on project Clases: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
This
java.lang.UnsupportedClassVersionError: clases/Clases has been compiled by a more recent version of the Java Runtime (class file version 59.0), this version of the Java Runtime only recognizes class file versions up to 55.0
is the reason.
You are trying to run classes that have been compiled for Java 15, but you are trying to use/compile them with Java 11
You either need to recompile those classes with Java 11, or use Java 15 on your Ubuntu computer

Can't execute goal org.eclipse.tycho:tycho-surefire-plugin:2.0.0:test (default-test) after switching to Java11

I'm trying to switch our legacy eclipse-plugin-based multi-modules project to Java-11, and made almost everything, except the "eclipse-test-plugin" projects. All of them throw a similar error
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.eclipse.osgi.internal.baseadaptor.BaseStorage (file:/home/USER/.m2/repository/p2/osgi/bundle/org.eclipse.osgi/3.9.1.v20140110-1610/org.eclipse.osgi-3.9.1.v20140110-1610.jar) to method java.net.URLClassLoader.addURL(java.net.URL)
WARNING: Please consider reporting this to the maintainers of org.eclipse.osgi.internal.baseadaptor.BaseStorage
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
An error has occurred. See the log file
/home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work/configuration/1599554461428.log.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.877 s
[INFO] Finished at: 2020-09-08T04:41:01-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:2.0.0:test (default-test) on project TEST-PROJECT: An unexpected error occurred while launching the test runtime (process returned error code 13). Command-line used to launch the sub-process was null -Dosgi.noShutdown=false -Dosgi.os=linux -Dosgi.ws=gtk -Dosgi.arch=x86_64 --illegal-access=permit -Dosgi.clean=true -jar /home/USER/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.3.0.v20130327-1440/org.eclipse.equinox.launcher-1.3.0.v20130327-1440.jar -data /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work/data -install /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work -configuration /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work/configuration -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/surefire.properties in working directory /home/USER/projects/java/PATH-TO-TEST-PROJECT -> [Help 1]
Here is the log file
!SESSION 2020-09-08 04:41:01.199 -----------------------------------------------
eclipse.buildId=unknown
java.version=11.0.7
java.vendor=AdoptOpenJDK
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/surefire.properties
Command-line arguments: -data /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work/data -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/surefire.properties
!ENTRY org.eclipse.osgi 4 0 2020-09-08 04:41:01.829
!MESSAGE Startup error
!STACK 1
java.lang.RuntimeException: Exception in org.eclipse.osgi.framework.internal.core.SystemBundleActivator.start() of bundle org.eclipse.osgi.
at org.eclipse.osgi.framework.internal.core.InternalSystemBundle.resume(InternalSystemBundle.java:233)
at org.eclipse.osgi.framework.internal.core.Framework.launch(Framework.java:656)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:275)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
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:566)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.osgi.framework.internal.core.SystemBundleActivator.start() of bundle org.eclipse.osgi.
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
at org.eclipse.osgi.framework.internal.core.InternalSystemBundle.resume(InternalSystemBundle.java:225)
... 11 more
Caused by: java.lang.IllegalStateException: The System Bundle could not be resolved: Missing Constraint: Bundle-RequiredExecutionEnvironment: J2SE-1.5
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.checkSystemState(BaseStorage.java:827)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.getStateManager(BaseStorage.java:800)
at org.eclipse.osgi.baseadaptor.BaseAdaptor.getState(BaseAdaptor.java:387)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.frameworkStart(BaseStorage.java:923)
at org.eclipse.osgi.baseadaptor.BaseAdaptor.frameworkStart(BaseAdaptor.java:250)
at org.eclipse.osgi.framework.internal.core.SystemBundleActivator.start(SystemBundleActivator.java:60)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
... 13 more
MANIFEST.MF looks like
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: PROJECT Test
Bundle-SymbolicName: TEST-PROJECT
Bundle-Version: 2.1.2
Bundle-Vendor: VENDOR
Fragment-Host: PROJECT-WHICH-IS-TESTED
Bundle-RequiredExecutionEnvironment: JavaSE-11
Import-Package: org.junit
Require-Bundle: org.junit
Automatic-Module-Name: TEST-PROJECT
and here is the parent pom with tycho-surefire-plugin
<pluginManagement>
...
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
<aggregate>true</aggregate>
<argLine>
--illegal-access=permit
</argLine>
</configuration>
</plugin>
</plugins>
</pluginManagement>
Here is the pom of the TEST-PROJECT
...
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<configuration>
<testSuite>${project.artifactId}</testSuite>
<testClass>${project.artifactId}.suite.TestSuite</testClass>
</configuration>
</plugin>
</plugins>
</build>
...
If run mvn clean install -X -e then I'll get
!ENTRY org.eclipse.osgi 4 0 2020-09-08 03:11:41.320
!MESSAGE Startup error
!STACK 1
java.lang.RuntimeException: Exception in org.eclipse.osgi.framework.internal.core.SystemBundleActivator.start() of bundle org.eclipse.osgi.
at org.eclipse.osgi.framework.internal.core.InternalSystemBundle.resume(InternalSystemBundle.java:233)
at org.eclipse.osgi.framework.internal.core.Framework.launch(Framework.java:656)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:275)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
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:566)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.osgi.framework.internal.core.SystemBundleActivator.start() of bundle org.eclipse.osgi.
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
at org.eclipse.osgi.framework.internal.core.InternalSystemBundle.resume(InternalSystemBundle.java:225)
... 11 more
Caused by: java.lang.IllegalStateException: The System Bundle could not be resolved: Missing Constraint: Bundle-RequiredExecutionEnvironment: J2SE-1.5
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.checkSystemState(BaseStorage.java:827)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.getStateManager(BaseStorage.java:800)
at org.eclipse.osgi.baseadaptor.BaseAdaptor.getState(BaseAdaptor.java:387)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.frameworkStart(BaseStorage.java:923)
at org.eclipse.osgi.baseadaptor.BaseAdaptor.frameworkStart(BaseAdaptor.java:250)
at org.eclipse.osgi.framework.internal.core.SystemBundleActivator.start(SystemBundleActivator.java:60)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
... 13 more
An error has occurred. See the log file
/home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work/configuration/1599549100674.log.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 49.043 s
[INFO] Finished at: 2020-09-08T03:11:41-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:1.7.0:test (default-test) on project com.navteq.phoenix.datatest.test: An unexpected error occurred while launching the test runtime (process returned error code 13). Command-line used to launch the sub-process was null -Dosgi.noShutdown=false -Dosgi.os=linux -Dosgi.ws=gtk -Dosgi.arch=x86_64 --illegal-access=permit -Dosgi.clean=true -jar /home/USER/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.3.0.v20130327-1440/org.eclipse.equinox.launcher-1.3.0.v20130327-1440.jar -debug -consolelog -data /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work/data -install /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work -configuration /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work/configuration -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/surefire.properties in working directory /home/USER/projects/java/PATH-TO-TEST-PROJECT -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:1.7.0:test (default-test) on project com.navteq.phoenix.datatest.test: An unexpected error occurred while launching the test runtime (process returned error code 13). Command-line used to launch the sub-process was null -Dosgi.noShutdown=false -Dosgi.os=linux -Dosgi.ws=gtk -Dosgi.arch=x86_64 --illegal-access=permit -Dosgi.clean=true -jar /home/USER/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.3.0.v20130327-1440/org.eclipse.equinox.launcher-1.3.0.v20130327-1440.jar -debug -consolelog -data /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work/data -install /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work -configuration /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work/configuration -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/surefire.properties in working directory /home/USER/projects/java/PATH-TO-TEST-PROJECT
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
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:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoFailureException: An unexpected error occurred while launching the test runtime (process returned error code 13). Command-line used to launch the sub-process was null -Dosgi.noShutdown=false -Dosgi.os=linux -Dosgi.ws=gtk -Dosgi.arch=x86_64 --illegal-access=permit -Dosgi.clean=true -jar /home/USER/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.launcher/1.3.0.v20130327-1440/org.eclipse.equinox.launcher-1.3.0.v20130327-1440.jar -debug -consolelog -data /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work/data -install /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work -configuration /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/work/configuration -application org.eclipse.tycho.surefire.osgibooter.headlesstest -testproperties /home/USER/projects/java/PATH-TO-TEST-PROJECT/target/surefire.properties in working directory /home/USER/projects/java/PATH-TO-TEST-PROJECT
at org.eclipse.tycho.surefire.TestMojo.runTest (TestMojo.java:1093)
at org.eclipse.tycho.surefire.TestMojo.execute (TestMojo.java:712)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
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:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[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
So could someone give some advice on what should I do in this situation?
P.S. Earlier all run successfully on Java8 with tycho-surefire 0.18.1 and Bundle-RequiredExecutionEnvironment: JavaSE-1.7
I believe that I've found the main root of my problem. The point is that in my parent pom.xml there was set an "Eclipse Kepler" as a repository. That's why when I used JavaSE-1.8, surefire plugin worked as expected, but when I switched to JavaSE-11, "Kepler" turned out to be obsolete and as a result, I get a strange error about
Missing Constraint: Bundle-RequiredExecutionEnvironment: J2SE-1.5
After changing to the latest eclipse repository, all tests were compiled and passed successfully.

How to fix "Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java" error running a Dataflow template from a VM instance in GCP?

I'm trying to execute the Dataflow template named PubSubToBigQuery.java at a VM instance (OS: "linux", version: "4.9.0-11-amd64", Distributor: Debian GNU/Linux 9.11 (stretch)) to take input messages from a Pub/Sub subscription and write them in a BigQuery table (without modifying the template for the moment). In order to do this I cloned the GitHub DataflowTemplates repo into my Cloud Shell in the $HOME/opt/ directory. Following the README document I've installed Java 8 and Maven 3:
Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00) Maven home: /opt/maven
Java version: 1.8.0_232, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.9.0-11-amd64", arch: "amd64", family: "unix"
After building the entire project, this is what I'm trying to execute from the comand line to compile the code:
sudo mvn -X compile exec:java -Dexec.mainClass=com.google.cloud.teleport.templates.PubSubToBigQuery -
Dexec.cleanupDaemonThreads=false -Dexec.args=" --project=real-demand --
stagingLocation=gs://rd_pubsub/staging --streaming=true"
And this is the error I'm getting:
[WARNING]
java.lang.ClassNotFoundException: com.google.cloud.teleport.templates.PubSubToBigQuery.java
at java.net.URLClassLoader.findClass (URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass (ClassLoader.java:424)
at java.lang.ClassLoader.loadClass (ClassLoader.java:357)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:270)
at java.lang.Thread.run (Thread.java:748)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:21 min
[INFO] Finished at: 2019-11-26T10:47:57Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project google-cloud-teleport-java: An exception occured while executing the Java class. com.google.cloud.teleport.templates.PubSubToBigQuery.java -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (default-cli) on project google-cloud-teleport-java: An exception occured while executing the Java class. com.google.cloud.teleport.templates.PubSubToBigQuery.java
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. com.google.cloud.teleport.templates.PubSubToBigQuery.java
at org.codehaus.mojo.exec.ExecJavaMojo.execute (ExecJavaMojo.java:339)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
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:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.ClassNotFoundException: com.google.cloud.teleport.templates.PubSubToBigQuery.java
at java.net.URLClassLoader.findClass (URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass (ClassLoader.java:424)
at java.lang.ClassLoader.loadClass (ClassLoader.java:357)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:270)
at java.lang.Thread.run (Thread.java:748)
[ERROR]
[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/MojoExecutionException
Following this post or this discussion discussion I've also added this piece of XML in pom.xml:
<properties>
<testNgMainClass>defaultMainClass</testNgMainClass>
<args>defaultArgs</args>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<classpathScope>test</classpathScope>
<mainClass>${testNgMainClass}</mainClass>
<arguments>${args}</arguments>
</configuration>
<executions>
<execution>
<id>run-selenium</id>
<phase>integration-test</phase>
<goals><goal>java</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
But it's still not working.
I can see that you are not specifying all the parameters needed to execute the template and as you mentioned, you are not modifying the file.
inputTopic=projects/${PROJECT_ID}/topics/input-topic-name
outputTableSpec=${PROJECT_ID}:dataset-id.output-table
outputDeadletterTable=${PROJECT_ID}:dataset-id.deadletter-table
The command should look like this:
mvn compile exec:java -Dexec.mainClass=com.google.cloud.teleport.templates.PubSubToBigQuery -Dexec.cleanupDaemonThreads=false \
-Dexec.args=" --project=PROJECT_ID \
--stagingLocation=gs://bucket-name/dataflow \
--streaming=true \
--inputTopic=projects/PROJECT_ID/topics/input-topic-name \
--outputTableSpec=PROJECT_ID:dataset-id.deadletter-table \
--outputDeadletterTable=PROJECT_ID:dataset-id.deadletter-table"
On the other hand, I recommend to deploy the template into GCP and execute using the gcloud command, follow the instructions given within the PubSubToBigQuery.java file
To clone, compile and run a Dataflow Template is necessary enable all the necessary APIs in your GCP project:
Dataflow
Compute Engine
Stackdriver Logging
Cloud Storage
Cloud Storage JSON
BigQuery
PubSub
In order to do that you can click in this helper link:
https://console.cloud.google.com/flows/enableapi?apiid=dataflow,compute_component,logging,storage_component,storage_api,bigquery,pubsub

org.apache.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19

When I use mvn site, reports are generated, but I have this exception in terminal:
[WARNING] Unable to process class module-info.class in JarAnalyzer File C:\WINDOWS\system32\config\systemprofile\.m2\repository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar
org.apache.bcel.classfile.ClassFormatException: Invalid byte tag in constant pool: 19
at org.apache.bcel.classfile.Constant.readConstant (Constant.java:161)
at org.apache.bcel.classfile.ConstantPool.<init> (ConstantPool.java:69)
at org.apache.bcel.classfile.ClassParser.readConstantPool (ClassParser.java:235)
at org.apache.bcel.classfile.ClassParser.parse (ClassParser.java:143)
at org.apache.maven.shared.jar.classes.JarClassesAnalysis.analyze (JarClassesAnalysis.java:96)
at org.apache.maven.report.projectinfo.dependencies.Dependencies.getJarDependencyDetails (Dependencies.java:259)
at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.hasSealed (DependenciesRenderer.java:1542)
at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderSectionDependencyFileDetails (DependenciesRenderer.java:545)
at org.apache.maven.report.projectinfo.dependencies.renderer.DependenciesRenderer.renderBody (DependenciesRenderer.java:240)
at org.apache.maven.reporting.AbstractMavenReportRenderer.render (AbstractMavenReportRenderer.java:83)
at org.apache.maven.report.projectinfo.DependenciesReport.executeReport (DependenciesReport.java:201)
at org.apache.maven.reporting.AbstractMavenReport.generate (AbstractMavenReport.java:255)
at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument (ReportDocumentRenderer.java:219)
at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule (DefaultSiteRenderer.java:319)
at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render (DefaultSiteRenderer.java:135)
at org.apache.maven.plugins.site.SiteMojo.renderLocale (SiteMojo.java:175)
at org.apache.maven.plugins.site.SiteMojo.execute (SiteMojo.java:138)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
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:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
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)
I use eclipse. This is simple maven project without selected archetype.
What could be the problem?
More info about maven and JDK:
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-
24T22:49:05+03:00)
Maven home: C:\Program Files\Apache Software Foundation\apache-maven-3.5.3\bin\..
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jre1.8.0_161
Default locale: en_US, platform encoding: Cp1251
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
I suspect this is caused by one of the tools in the tool chain (incorrectly) trying to load classes from the META-INF/versions/java9 directory in the log4j-api jar.
Can you use a version of BCEL that is “multi -version jar-aware” and doesn’t try to do this?
For all this time I have found only solution with reducing log4j2 version from 2.10.0 to 2.9.1.
to solve please try to add the following to your pom
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-jar</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>bcel-findbugs</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.bcel</groupId>
<artifactId>bcel</artifactId>
<version>6.2</version>
</dependency>
</dependencies>
</plugin>
Solved the issue for my build

Categories

Resources