Maven plugin Container exception - java

I am trying to do my own Jira plugin following the tutorial from Atlassian for hello world or importing an existing plugin from their git repo.
After cloning the git repo, I tried to do a Maven clean install on the project but I get a PluginContainerException with the following stacktrace.
Failed to execute goal com.atlassian.maven.plugins:maven-jira-plugin:4.2.0:copy-bundled-dependencies (default-copy-bundled-dependencies) on project new-listener-plugin: Execution default-copy-bundled-dependencies of goal com.atlassian.maven.plugins:maven-jira-plugin:4.2.0:copy-bundled-dependencies failed:
An API incompatibility was encountered while executing com.atlassian.maven.plugins:maven-jira-plugin:4.2.0:copy-bundled-dependencies: java.lang.NoSuchMethodError: org.apache.maven.execution.MavenSession.getRepositorySession()Lorg/sonatype/aether/RepositorySystemSession;
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>com.atlassian.maven.plugins:maven-jira-plugin:4.2.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/myname/.m2/repository/com/atlassian/maven/plugins/maven-jira-plugin/4.2.0/maven-jira-plugin-4.2.0.jar
[ERROR] urls[1] = file:/C:/Users/myname/.m2/repository/com/atlassian/maven/archetypes/jira-plugin-archetype/4.2.0/jira-plugin-archetype-4.2.0.jar
[ERROR] urls[2] = file:/C:/Users/myname/.m2/repository/com/atlassian/maven/plugins/maven-amps-plugin/4.2.0/maven-amps-plugin-4.2.0.jar
[ERROR] urls[3] = file:/C:/Users/myname/.m2/repository/com/atlassian/core/atlassian-core/4.0/atlassian-core-4.0.jar
[ERROR] urls[4] = file:/C:/Users/myname/.m2/repository/com/atlassian/profiling/atlassian-profiling/1.3/atlassian-profiling-1.3.jar
[ERROR] urls[5] = file:/C:/Users/myname/.m2/repository/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar
[ERROR] urls[6] = file:/C:/Users/myname/.m2/repository/p6spy/p6spy/1.3/p6spy-1.3.jar
[ERROR] urls[7] = file:/C:/Users/myname/.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1.jar
[ERROR] urls[8] = file:/C:/Users/myname/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar
[ERROR] urls[9] = file:/C:/Users/myname/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
[ERROR] urls[10] = file:/C:/Users/myname/.m2/repository/osuser/osuser/1.0-dev-log4j-1.4jdk-7Dec05/osuser-1.0-dev-log4j-1.4jdk-7Dec05.jar
[ERROR] urls[11] = file:/C:/Users/myname/.m2/repository/opensymphony/propertyset/1.3-21Nov03/propertyset-1.3-21Nov03.jar
[ERROR] urls[12] = file:/C:/Users/myname/.m2/repository/opensymphony/sitemesh/2.3/sitemesh-2.3.jar
[ERROR] urls[13] = file:/C:/Users/myname/.m2/repository/dom4j/dom4j/1.4/dom4j-1.4.jar
[ERROR] urls[14] = file:/C:/Users/myname/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
[ERROR] urls[15] = file:/C:/Users/myname/.m2/repository/jaxen/jaxen/1.0-FCS/jaxen-1.0-FCS.jar
[ERROR] urls[16] = file:/C:/Users/myname/.m2/repository/saxpath/saxpath/1.0-FCS/saxpath-1.0-FCS.jar
[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/PluginContainerException

This is caused by incompatible Maven and maven-amps-plugin versions. This project currently referencing maven-amps-plugin version 4.2.0, and that works only with Maven2. Since you are likely using Maven 3, you need to:
change the maven-amps-plugin dependency in your pom to something much newer (like 5.1.18)
optionally you can download an older Maven version (Maven2) and use that if you do not want to touch this project.

Related

An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar

I have encountered problems while trying to run sonarqube on my application. When I execute the command it throws me an error which doesn't say much to me. Does anyone know where is the problem here?
The Error looks like this:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.257 s
[INFO] Finished at: 2022-12-07T15:10:39+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project TeamTracker: Execution default-cli of goal org.sonarsource.sca
nner.maven:sonar-maven-plugin:3.9.1.2184:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar: java.la
ng.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.codehaus.mojo:sonar-maven-plugin:3.9.1.2184
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/A113408609/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.9.1.2184/sonar-maven-plugin-3.9.1.2184.jar
[ERROR] urls[1] = file:/C:/Users/A113408609/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[2] = file:/C:/Users/A113408609/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[3] = file:/C:/Users/A113408609/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar
[ERROR] urls[4] = file:/C:/Users/A113408609/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.2.588/sonar-scanner-api-2.16.2.588.jar
[ERROR] urls[5] = file:/C:/Users/A113408609/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security
.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module #26f204a4
[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/PluginContainerException
'cmd' is not recognized as an internal or external command,
operable program or batch file.
This is a command I execute:
mvn sonar:sonar -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.login=$SONAR_AUTH_TOKEN -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.projectName=$CI_PROJECT_PATH_SLUG
I have gone through documentations but I still really can't see what is the problem here :/
When I try to run mvn clean install the build is succesfull.
I am using Java 11, Maven 3.6.3 and Sonar Community Edition Version 8.9.10

org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar failed: An API incompatibility was encountered while executing

my Software version
sonarqube 7.0
maven: 3.6.3
jdk: 17
sonar-maven-plugin: 3.8.0.2131
when I run
mvn --batch-mode clean verify
org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar
-Dsonar.host.url=http://***
-Dsonar.login=***
-Dsonar.password=***
-Dsonar.issuesReport.console.enable=true
-Dsonar.gitlab.commit_sha=30ddd2484f6a487bcbea96775d497e0bffa87653
-Dsonar.gitlab.ref_name=***
-Dsonar.gitlab.project_id=***
-Dsonar.analysis.mode=preview
-Dsonar.preview.excludePlugins=issueassign,scmstats
-Dmaven.test.skip=true
and I've set this parameter export SONAR_SCANNER_OPTS="--illegal-access=permit"
but it error as follows
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar (default-cli) on project train-mc: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/root/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.8.0.2131/sonar-maven-plugin-3.8.0.2131.jar
[ERROR] urls[1] = file:/root/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[2] = file:/root/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[3] = file:/root/.m2/repository/org/codehaus/plexus/plexus-utils/3.2.1/plexus-utils-3.2.1.jar
[ERROR] urls[4] = file:/root/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.0.226/sonar-scanner-api-2.16.0.226.jar
[ERROR] urls[5] = file:/root/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module #539a50ea
May need to upgrade sonarqube server's version
https://community.sonarsource.com/t/support-java-17-in-the-sonar-maven-plugin/51931

Maven transitive dependency issue with maven-jetty-plugin

I have a project called Animal and it have two submodules Animal-models and Animal-server. The Animal-models have a compile time dependency xyz and the Animal-server have dependency on Animal-models jar. And the Animal-server generates a war file for running on jetty server. Everything is working fine currently. With the new changes dependency xyz is removed from Animal-models project and all of a sudden the server jetty run is failing with following exception. How to find out which jar is causing the issue?
[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.4.8.v20171121:run (default-cli) on project ccd-event-service: Execution default-cli of goal org.eclipse.jetty:jetty-maven-plugin:9.4.8.v20171121:run failed: A required class was missing while executing org.eclipse.jetty:jetty-maven-plugin:9.4.8.v20171121:run: org/jboss/resteasy/plugins/guice/ModuleProcessor
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.eclipse.jetty:jetty-maven-plugin:9.4.8.v20171121
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-maven-plugin/9.4.8.v20171121/jetty-maven-plugin-9.4.8.v20171121.jar
[ERROR] urls[1] = file:/Users/crazyCow/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar
[ERROR] urls[2] = file:/Users/crazyCow/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.3/org.eclipse.sisu.inject-0.3.3.jar
[ERROR] urls[3] = file:/Users/crazyCow/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.jar
[ERROR] urls[4] = file:/Users/crazyCow/.m2/repository/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar
[ERROR] urls[5] = file:/Users/crazyCow/.m2/repository/org/apache/maven/maven-builder-support/3.5.0/maven-builder-support-3.5.0.jar
[ERROR] urls[6] = file:/Users/crazyCow/.m2/repository/com/google/guava/guava/20.0/guava-20.0.jar
[ERROR] urls[7] = file:/Users/crazyCow/.m2/repository/org/apache/maven/resolver/maven-resolver-util/1.0.3/maven-resolver-util-1.0.3.jar
[ERROR] urls[8] = file:/Users/crazyCow/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.1.0/maven-shared-utils-3.1.0.jar
[ERROR] urls[9] = file:/Users/crazyCow/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
[ERROR] urls[10] = file:/Users/crazyCow/.m2/repository/com/google/inject/guice/4.0/guice-4.0-no_aop.jar
[ERROR] urls[11] = file:/Users/crazyCow/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[12] = file:/Users/crazyCow/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.24/plexus-interpolation-1.24.jar
[ERROR] urls[13] = file:/Users/crazyCow/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.7.1/plexus-component-annotations-1.7.1.jar
[ERROR] urls[14] = file:/Users/crazyCow/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[15] = file:/Users/crazyCow/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[16] = file:/Users/crazyCow/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-tools-api/3.5/maven-plugin-tools-api-3.5.jar
[ERROR] urls[17] = file:/Users/crazyCow/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[18] = file:/Users/crazyCow/.m2/repository/org/apache/maven/shared/maven-artifact-transfer/0.9.1/maven-artifact-transfer-0.9.1.jar
[ERROR] urls[19] = file:/Users/crazyCow/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/3.0.1/maven-common-artifact-filters-3.0.1.jar
[ERROR] urls[20] = file:/Users/crazyCow/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[21] = file:/Users/crazyCow/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[22] = file:/Users/crazyCow/.m2/repository/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
[ERROR] urls[23] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-util/9.4.8.v20171121/jetty-util-9.4.8.v20171121.jar
[ERROR] urls[24] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-webapp/9.4.8.v20171121/jetty-webapp-9.4.8.v20171121.jar
[ERROR] urls[25] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-xml/9.4.8.v20171121/jetty-xml-9.4.8.v20171121.jar
[ERROR] urls[26] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-servlet/9.4.8.v20171121/jetty-servlet-9.4.8.v20171121.jar
[ERROR] urls[27] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-quickstart/9.4.8.v20171121/jetty-quickstart-9.4.8.v20171121.jar
[ERROR] urls[28] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-jaas/9.4.8.v20171121/jetty-jaas-9.4.8.v20171121.jar
[ERROR] urls[29] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-security/9.4.8.v20171121/jetty-security-9.4.8.v20171121.jar
[ERROR] urls[30] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-plus/9.4.8.v20171121/jetty-plus-9.4.8.v20171121.jar
[ERROR] urls[31] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-jndi/9.4.8.v20171121/jetty-jndi-9.4.8.v20171121.jar
[ERROR] urls[32] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-server/9.4.8.v20171121/jetty-server-9.4.8.v20171121.jar
[ERROR] urls[33] = file:/Users/crazyCow/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar
[ERROR] urls[34] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-http/9.4.8.v20171121/jetty-http-9.4.8.v20171121.jar
[ERROR] urls[35] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-io/9.4.8.v20171121/jetty-io-9.4.8.v20171121.jar
[ERROR] urls[36] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-jmx/9.4.8.v20171121/jetty-jmx-9.4.8.v20171121.jar
[ERROR] urls[37] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-annotations/9.4.8.v20171121/jetty-annotations-9.4.8.v20171121.jar
[ERROR] urls[38] = file:/Users/crazyCow/.m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar
[ERROR] urls[39] = file:/Users/crazyCow/.m2/repository/org/ow2/asm/asm/6.0/asm-6.0.jar
[ERROR] urls[40] = file:/Users/crazyCow/.m2/repository/org/ow2/asm/asm-commons/6.0/asm-commons-6.0.jar
[ERROR] urls[41] = file:/Users/crazyCow/.m2/repository/org/ow2/asm/asm-tree/6.0/asm-tree-6.0.jar
[ERROR] urls[42] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-server-impl/9.4.8.v20171121/javax-websocket-server-impl-9.4.8.v20171121.jar
[ERROR] urls[43] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/javax-websocket-client-impl/9.4.8.v20171121/javax-websocket-client-impl-9.4.8.v20171121.jar
[ERROR] urls[44] = file:/Users/crazyCow/.m2/repository/javax/websocket/javax.websocket-client-api/1.0/javax.websocket-client-api-1.0.jar
[ERROR] urls[45] = file:/Users/crazyCow/.m2/repository/javax/websocket/javax.websocket-api/1.0/javax.websocket-api-1.0.jar
[ERROR] urls[46] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/websocket-server/9.4.8.v20171121/websocket-server-9.4.8.v20171121.jar
[ERROR] urls[47] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/websocket-common/9.4.8.v20171121/websocket-common-9.4.8.v20171121.jar
[ERROR] urls[48] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/websocket-api/9.4.8.v20171121/websocket-api-9.4.8.v20171121.jar
[ERROR] urls[49] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/websocket-client/9.4.8.v20171121/websocket-client-9.4.8.v20171121.jar
[ERROR] urls[50] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/jetty-client/9.4.8.v20171121/jetty-client-9.4.8.v20171121.jar
[ERROR] urls[51] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/websocket/websocket-servlet/9.4.8.v20171121/websocket-servlet-9.4.8.v20171121.jar
[ERROR] urls[52] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/apache-jsp/9.4.8.v20171121/apache-jsp-9.4.8.v20171121.jar
[ERROR] urls[53] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/toolchain/jetty-schemas/3.1/jetty-schemas-3.1.jar
[ERROR] urls[54] = file:/Users/crazyCow/.m2/repository/org/mortbay/jasper/apache-jsp/8.5.23/apache-jsp-8.5.23.jar
[ERROR] urls[55] = file:/Users/crazyCow/.m2/repository/org/mortbay/jasper/apache-el/8.5.23/apache-el-8.5.23.jar
[ERROR] urls[56] = file:/Users/crazyCow/.m2/repository/org/eclipse/jdt/ecj/3.12.3/ecj-3.12.3.jar
[ERROR] urls[57] = file:/Users/crazyCow/.m2/repository/org/eclipse/jetty/apache-jstl/9.4.8.v20171121/apache-jstl-9.4.8.v20171121.jar
[ERROR] urls[58] = file:/Users/crazyCow/.m2/repository/org/apache/taglibs/taglibs-standard-spec/1.2.5/taglibs-standard-spec-1.2.5.jar
[ERROR] urls[59] = file:/Users/crazyCow/.m2/repository/org/apache/taglibs/taglibs-standard-impl/1.2.5/taglibs-standard-impl-1.2.5.jar
[ERROR] urls[60] = file:/Users/crazyCow/.m2/repository/javax/transaction/javax.transaction-api/1.2/javax.transaction-api-1.2.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : org.jboss.resteasy.plugins.guice.ModuleProcessor
[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/PluginContainerException
Scope provided means that artifact is not packed within warfile, but is provided by container environment. Its typically used i.e. for servlet api.
As resteasy originates from jboss, they probably expect you to use their framework in jboss. Not in jetty. Hence default scope of the artifact seems to be "provided" - not packed in war.
But as you executed it in jetty,which is not jboss so that that it does not provide jboss jars and they are simply not there. So your "workaround" was The right thing to do.

Installing the Application using Maven

When I'm cleaning the project on command line using the command
Project_path>mvn clean then the project build is a success...When I use command project_path>mvn install I'm getting the following issue
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate (generate-chg-xsd) on project incode-ecp-iso20022-pain: Execution generate-chg-xsd of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate failed: A required class was missing while executing org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate: com/sun/xml/bind/api/ErrorListener
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/Mizpahsoft/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb2-plugin/0.13.1/maven-jaxb2-plugin-0.13.1.jar
[ERROR] urls[1] = file:/C:/Users/Mizpahsoft/.m2/repository/org/jvnet/jaxb2_commons/jaxb2-namespace-prefix/1.1/jaxb2-namespace-prefix-1.1.jar
[ERROR] urls[2] = file:/C:/Users/Mizpahsoft/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb2-plugin-core/0.13.1/maven-jaxb2-plugin-core-0.13.1.jar
[ERROR] urls[3] = file:/C:/Users/Mizpahsoft/.m2/repository/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1.jar
[ERROR] urls[4] = file:/C:/Users/Mizpahsoft/.m2/repository/com/sun/org/apache/xml/internal/resolver/20050927/resolver-20050927.jar
[ERROR] urls[5] = file:/C:/Users/Mizpahsoft/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[ERROR] urls[6] = file:/C:/Users/Mizpahsoft/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar
[ERROR] urls[7] = file:/C:/Users/Mizpahsoft/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.jar
[ERROR] urls[8] = file:/C:/Users/Mizpahsoft/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb22-plugin/0.13.1/maven-jaxb22-plugin-0.13.1.jar
[ERROR] urls[9] = file:/C:/Users/Mizpahsoft/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.2.11/jaxb-runtime-2.2.11.jar
[ERROR] urls[10] = file:/C:/Users/Mizpahsoft/.m2/repository/org/glassfish/jaxb/jaxb-xjc/2.2.11/jaxb-xjc-2.2.11.jar
[ERROR] urls[11] = file:/C:/Users/Mizpahsoft/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.4/maven-plugin-annotations-3.4.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : com.sun.xml.bind.api.ErrorListener
[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/PluginContainerException
mvn clean doesn't actually do anything other than cleaning up the folders and old compilation residue (as is clear from the name).
mvn install on the other hand, will try to compile your code and then package it before adding it to your local repository.
Your mvn install is failing because apparently, your pom.xml is missing a dependency for JAXB.
Modify it to include the dependency.
Add the following in your dependencies:
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.12</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
Since the dependency lies at maven2 central, you'll also need to add the following (might be the case if you already have the above-mentioned dependency in your pom) :
<repositories>
<repository>
<id>central</id>
<url>http://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>

Error when trying to use org.codehaus.mojo:cobertura-maven-plugin:2.6

I'm trying to use the Cobertura maven plugin for code coverage. But I am getting an error when running the following command:
mvn clean package cobertura:cobertura -Dcobertura.report.format=xml
Here is how I have the plugin defined in my pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<formats>
<format>xml</format>
</formats>
<instrumentation>
<excludes>
<include>**/*.class</include>
<exclude>**/*Test.class</exclude>
<exclude>**/Test*.class</exclude>
</excludes>
</instrumentation>
</configuration>
</plugin>
And here is the error I am receiving:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:09.201s
[INFO] Finished at: Thu Aug 21 17:28:24 GMT+00:00 2014
[INFO] Final Memory: 25M/64M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:cobertura-maven-plugin:2.6:instrument (default-cli) on project project-beta: Execution default-cli of goal org.codehaus.mojo:cobertura-maven-plugin:2.6:instrument failed: A required class was missing while executing org.codehaus.mojo:cobertura-maven-plugin:2.6:instrument: net/sourceforge/cobertura/util/CommandLineBuilder
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.codehaus.mojo:cobertura-maven-plugin:2.6
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/data/home/user/.m2/repository/org/codehaus/mojo/cobertura-maven-plugin/2.6/cobertura-maven-plugin-2.6.jar
[ERROR] urls[1] = file:/data/home/user/.m2/repository/net/sourceforge/cobertura/cobertura/2.0.3/cobertura-2.0.3.jar
[ERROR] urls[2] = file:/data/home/user/.m2/repository/org/ow2/asm/asm/4.1/asm-4.1.jar
[ERROR] urls[3] = file:/data/home/user/.m2/repository/org/ow2/asm/asm-tree/4.1/asm-tree-4.1.jar
[ERROR] urls[4] = file:/data/home/user/.m2/repository/org/ow2/asm/asm-commons/4.1/asm-commons-4.1.jar
[ERROR] urls[5] = file:/data/home/user/.m2/repository/org/ow2/asm/asm-util/4.1/asm-util-4.1.jar
[ERROR] urls[6] = file:/data/home/user/.m2/repository/org/ow2/asm/asm-analysis/4.1/asm-analysis-4.1.jar
[ERROR] urls[7] = file:/data/home/user/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar
[ERROR] urls[8] = file:/data/home/user/.m2/repository/jaxen/jaxen/1.1-beta-8/jaxen-1.1-beta-8.jar
[ERROR] urls[9] = file:/data/home/user/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
[ERROR] urls[10] = file:/data/home/user/.m2/repository/jdom/jdom/1.0/jdom-1.0.jar
[ERROR] urls[11] = file:/data/home/user/.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar
[ERROR] urls[12] = file:/data/home/user/.m2/repository/xerces/xercesImpl/2.6.2/xercesImpl-2.6.2.jar
[ERROR] urls[13] = file:/data/home/user/.m2/repository/xom/xom/1.0b3/xom-1.0b3.jar
[ERROR] urls[14] = file:/data/home/user/.m2/repository/com/ibm/icu/icu4j/2.6.1/icu4j-2.6.1.jar
[ERROR] urls[15] = file:/data/home/user/.m2/repository/xalan/xalan/2.6.0/xalan-2.6.0.jar
[ERROR] urls[16] = file:/data/home/user/.m2/repository/org/ccil/cowan/tagsoup/tagsoup/0.9.7/tagsoup-0.9.7.jar
[ERROR] urls[17] = file:/data/home/user/.m2/repository/org/apache/ant/ant/1.8.3/ant-1.8.3.jar
[ERROR] urls[18] = file:/data/home/user/.m2/repository/org/apache/ant/ant-launcher/1.8.3/ant-launcher-1.8.3.jar
[ERROR] urls[19] = file:/data/home/user/.m2/repository/org/mortbay/jetty/servlet-api-2.5/6.1.14/servlet-api-2.5-6.1.14.jar
[ERROR] urls[20] = file:/data/home/user/.m2/repository/org/mortbay/jetty/jetty/6.1.14/jetty-6.1.14.jar
[ERROR] urls[21] = file:/data/home/user/.m2/repository/org/mortbay/jetty/jetty-util/6.1.14/jetty-util-6.1.14.jar
[ERROR] urls[22] = file:/data/java/jdk1.7.0_45/jre/../lib/tools.jar
[ERROR] urls[23] = file:/data/home/user/.m2/repository/log4j/log4j/1.2.9/log4j-1.2.9.jar
[ERROR] urls[24] = file:/data/home/user/.m2/repository/net/sourceforge/cobertura/cobertura-runtime/2.0.3/cobertura-runtime-2.0.3.pom
[ERROR] urls[25] = file:/data/home/user/.m2/repository/urbanophile/java-getopt/1.0.9/java-getopt-1.0.9.jar
[ERROR] urls[26] = file:/data/home/user/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
[ERROR] urls[27] = file:/data/home/user/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[28] = file:/data/home/user/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.8/maven-reporting-api-2.0.8.jar
[ERROR] urls[29] = file:/data/home/user/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-9/doxia-sink-api-1.0-alpha-9.jar
[ERROR] urls[30] = file:/data/home/user/.m2/repository/org/apache/maven/reporting/maven-reporting-impl/2.0.4.2/maven-reporting-impl-2.0.4.2.jar
[ERROR] urls[31] = file:/data/home/user/.m2/repository/commons-validator/commons-validator/1.2.0/commons-validator-1.2.0.jar
[ERROR] urls[32] = file:/data/home/user/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar
[ERROR] urls[33] = file:/data/home/user/.m2/repository/commons-digester/commons-digester/1.6/commons-digester-1.6.jar
[ERROR] urls[34] = file:/data/home/user/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
[ERROR] urls[35] = file:/data/home/user/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
[ERROR] urls[36] = file:/data/home/user/.m2/repository/org/apache/maven/doxia/doxia-core/1.0/doxia-core-1.0.jar
[ERROR] urls[37] = file:/data/home/user/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.0/doxia-site-renderer-1.0.jar
[ERROR] urls[38] = file:/data/home/user/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar
[ERROR] urls[39] = file:/data/home/user/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.7/plexus-velocity-1.1.7.jar
[ERROR] urls[40] = file:/data/home/user/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar
[ERROR] urls[41] = file:/data/home/user/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.0/doxia-decoration-model-1.0.jar
[ERROR] urls[42] = file:/data/home/user/.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar
[ERROR] urls[43] = file:/data/home/user/.m2/repository/org/apache/maven/doxia/doxia-module-apt/1.0/doxia-module-apt-1.0.jar
[ERROR] urls[44] = file:/data/home/user/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.0/doxia-module-fml-1.0.jar
[ERROR] urls[45] = file:/data/home/user/.m2/repository/org/apache/maven/doxia/doxia-module-xdoc/1.0/doxia-module-xdoc-1.0.jar
[ERROR] urls[46] = file:/data/home/user/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.0/doxia-module-xhtml-1.0.jar
[ERROR] urls[47] = file:/data/home/user/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar
[ERROR] urls[48] = file:/data/home/user/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.2/plexus-utils-2.0.2.jar
[ERROR] urls[49] = file:/data/home/user/.m2/repository/org/apache/maven/shared/maven-invoker/2.0.11/maven-invoker-2.0.11.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: net.sourceforge.cobertura.util.CommandLineBuilder
[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/PluginContainerException
Build step 'Invoke top-level Maven targets' marked build as failure
Skipping Cobertura coverage report as build was not UNSTABLE or better ...
Finished: FAILURE
I have already cleared my local repository and tried running it again, but no luck.
Any other suggestions?
I am using Maven 3.1.0 and Java 1.7.0_45
UPDATE:
I am using Nexus as a repo manager. Looking in the logs I see:
[INFO] Failed to parse Maven artifact /data/home/user/sonatype-work/nexus/storage/central/net/sourceforge/cobertura/cobertura/2.0.3/cobertura-2.0.3.jar due to invalid CEN header (bad signature)
This seems to suggest that this jar is corrupt. But I keep trying to redownload it from Maven Central. Still stuck.
I was also facing this issue and the issue was with Java version in Maven. It may happen you have multiple JDK version in system or your Maven referring to some other JDK version.
So first you can check the maven and referring version by typing below command in your maven project directory.
mvn -v
ITSs-MacBook-Pro:workbench vshah$ mvn -v Apache Maven 3.6.3
(cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home:
/usr/local/Cellar/maven/3.6.3_1/libexec Java version: 1.8.0_241,
vendor: Oracle Corporation, runtime:
/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/jre
Default locale: en_GB, platform encoding: UTF-8 OS name: "mac os x",
version: "10.14.3", arch: "x86_64", family: "mac"
And check the maven and JDK version. If you found maven's JDK version not referring to required JDK version then you need to check your JAVA_HOME path. If you set JAVA_HOME path correctly it will work for sure.
Use this:-
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<reportSets>
<reportSet>
<reports>
<report>cobertura</report>
</reports>
</reportSet>
</reportSets>
</configuration>
</plugin>
Please check your path variable.
You might be pointing it to jre bin path, it should point to jdk bin.
I had the same issue, i did the above solution it worked for me.
Try out downloading from external site and place it in your local repository.
If you guys are using jenkins and facing issue while executing Descriptive jobs then check the configuration as well,
if you have selected Auto install option for maven and Java in "Global Tool configuration" then unclick it and add the directory manually where your maven and java is installed on jenkins server.
Most important line is A required class was missing while executing org.codehaus.mojo:cobertura-maven-plugin:2.6:instrument: net/sourceforge/cobertura/util/CommandLineBuilder.
Verify if the jar containing this class (i.e file:/data/home/user/.m2/repository/net/sourceforge/cobertura/cobertura/2.0.3/cobertura-2.0.3.jar) is corrupted. Is so, remove it from your local repository. If you're using a Repository Manager as well, verify it that one is corrupt as well and needs to be removed. Next give it another try.

Categories