I can make Sonar scanner work with OpenJDK 8 but not with OpenJDK 11.
The Maven command used is:
mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent verify sonar:sonar -Dsonar.analysis.mode=preview -Dsonar.report.export.path=sonar-report.json -P ci
The build fails with:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project framework-bio: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar: javax/xml/bind/ValidationEventHandler
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.codehaus.mojo:sonar-maven-plugin:3.4.0.905
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/var/lib/jenkins/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.4.0.905/sonar-maven-plugin-3.4.0.905.jar
[ERROR] urls[1] = file:/var/lib/jenkins/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[2] = file:/var/lib/jenkins/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[3] = file:/var/lib/jenkins/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[4] = file:/var/lib/jenkins/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.10.0.1189/sonar-scanner-api-2.10.0.1189.jar
[ERROR] urls[5] = file:/var/lib/jenkins/.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] -----------------------------------------------------: javax.xml.bind.ValidationEventHandler
[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
Is Sonar Scanner expected to work with JDK 11?
I finally found https://github.com/sonargraph/sonar-sonargraph-integration/issues/14
The issue is coming from SonarQube plugin named sonar-sonargraph-integration.
I uninstalled the plugin from SonarQube server and the issue went away.
Related
I follow this quarkus guide : https://quarkus.io/guides/getting-started and everything works fine on my local machine. However when I push my code and launch a jenkins build I got the following error :
11:19:24 [INFO] [jenkins-event-spy] Generated /home/jenkins/workspace/middleware_snapshot_develop-EKIMU4RSDFMZGBZA3XCVKQY7EEXFYGGT2UK5R5N3NP636H36IDJQ#tmp/withMavenc261dc7b/maven-spy-20200505-091643-8556196817679207068499.log
11:19:24 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project mytraindata-quarkus-test: Execution default-deploy of goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy: java.lang.NoSuchMethodError: org.eclipse.aether.spi.connector.ArtifactUpload.getFileTransformer()Lorg/eclipse/aether/transform/FileTransformer;
11:19:24 [ERROR] -----------------------------------------------------
11:19:24 [ERROR] realm = plugin>org.apache.maven.plugins:maven-deploy-plugin:2.8.2
11:19:24 [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
11:19:24 [ERROR] urls[0] = file:/root/.m2/repository/org/apache/maven/plugins/maven-deploy-plugin/2.8.2/maven-deploy-plugin-2.8.2.jar
11:19:24 [ERROR] urls[1] = file:/root/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
11:19:24 [ERROR] urls[2] = file:/root/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar
11:19:24 [ERROR] urls[3] = file:/root/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
11:19:24 [ERROR] urls[4] = file:/root/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.15/plexus-utils-3.0.15.jar
11:19:24 [ERROR] Number of foreign imports: 1
11:19:24 [ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
11:19:24 [ERROR]
11:19:24 [ERROR] -----------------------------------------------------
11:19:24 [ERROR] -> [Help 1]
11:19:24 [ERROR]
11:19:24 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
11:19:24 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
11:19:24 [ERROR]
11:19:24 [ERROR] For more information about the errors and possible solutions, please read the following articles:
11:19:24 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
11:19:24 [ERROR]
11:19:24 [ERROR] After correcting the problems, you can resume the build with the command
11:19:24 [ERROR] mvn <goals> -rf :mytraindata-quarkus-test
Note that I have another quarkus project with the old bom which build fine:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bom</artifactId>
<version>1.1.1.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
as opposite of the new one which fails:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-universe-bom</artifactId>
<version>1.4.1.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
I suspect that the error comes from the new bom.
Here is the configuration :
10:22:57 Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T19:49:05Z)
10:22:57 Maven home: /usr/share/maven
10:22:57 Java version: 1.8.0_171, vendor: Oracle Corporation
10:22:57 Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
10:22:57 Default locale: en, platform encoding: UTF-8
10:22:57 OS name: "linux", version: "3.10.0-957.21.2.el7.x86_64", arch: "amd64", family: "unix"
I ve installed maven 3.5.3 on my local machine and I can successfully build the project.
So I don't know what causes this failure...
Any help ?
Thank you !
The minimum Maven version for newest Quarkus version is 3.6.2. Can you try upgrading to the latest Maven release?
It really looks like Maven failing due to incompatible versions.
docker sonarqube latest version 6.7.1 broke my maven build on java 9:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar (default-cli) on project request-work: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905:sonar: javax/xml/bind/ValidationEventHandler
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.0.905
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/jenkins/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.4.0.905/sonar-maven-plugin-3.4.0.905.jar
[ERROR] urls[1] = file:/home/jenkins/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[2] = file:/home/jenkins/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[3] = file:/home/jenkins/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[4] = file:/home/jenkins/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.10.0.1189/sonar-scanner-api-2.10.0.1189.jar
[ERROR] urls[5] = file:/home/jenkins/.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] : javax.xml.bind.ValidationEventHandler
[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]
The same configuration on java 8 work perfect.
How to fix it?
On the SonarQube requirements page you can read that SonarQube
only supports Open JDK 8 and Oracle JRE 8. So you need that runtime to run a SonarQube analysis and the SonarQube Website.
The main problem is the current ElasticSearch engine included in the product (support for Java 9 is added in ElasticSearch 6.2,
see also JIRA item SONAR-10574).
You can read for example in this blog that JDK 9 is obselete so
developers need to migrate the code to JDK 10, JDK 11 (later this year) or fallback to JDK 8. See also
this SO question asking for the plans
for the SonarQube 7.x versions, still without an answer. There is a big chance that support for the next Java runtime will be build into
the 7.x version and not in the 6.x versions. You can analyse Java 9 code. See this
SO question for the details.
I am new to Maven and learning it by myself with the help of online tutorials.
I have been getting error while executing archetype:generate command in cmd.
Here is the error I am getting :\
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.884 s
[INFO] Finished at: 2017-05-07T23:00:07+05:30
[INFO] Final Memory: 8M/65M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli) on project standalone-pom: Execution default-cli of goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate failed: Unable to load the mojo 'generate' (or one of its required components) from the plugin 'org.apache.maven.plugins:maven-archetype-plugin:3.0.1': com.google.inject.ProvisionException: Unable to provision, see the following errors:
[ERROR]
[ERROR] 1) No implementation for org.apache.maven.archetype.ArchetypeManager was bound.
[ERROR] while locating org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo
[ERROR] at ClassRealm[plugin>org.apache.maven.plugins:maven-archetype-plugin:3.0.1, parent: sun.misc.Launcher$AppClassLoader#70dea4e] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
[ERROR] while locating org.apache.maven.plugin.Mojo annotated with #com.google.inject.name.Named(value=org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate)
[ERROR]
[ERROR] 1 error
[ERROR] role: org.apache.maven.plugin.Mojo
[ERROR] roleHint: org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate
[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
I have searched a lot for the solution but nowhere did I find appropriate answer. I have uptil now completed the following steps: 1)Downloaded and extracted "apache-maven-3.5.0". 2)Configured the M2_HOME and PATH variables.
I am trying to integrate allure-report with my junit code.
To try this, i was first trying to run the allure-junit example from https://github.com/allure-examples/allure-junit-example
When i run this code, i get the below error.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire- plugin:2.18:test (default-test) on project SampleAllureTest: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18:test failed: There was an error in the forked process
[ERROR] java.lang.NoSuchMethodError: org.apache.commons.beanutils.ConvertUtilsBean.register(ZZI)V
[ERROR] at ru.yandex.qatools.properties.decorators.DefaultFieldDecorator.<init>(DefaultFieldDecorator.java:24)
[ERROR] at ru.yandex.qatools.properties.PropertyLoader.populate(PropertyLoader.java:29)
[ERROR] at ru.yandex.qatools.properties.PropertyLoader.populate(PropertyLoader.java:23)
[ERROR] at ru.yandex.qatools.allure.config.AllureConfig.<init>(AllureConfig.java:80)
[ERROR] at ru.yandex.qatools.allure.config.AllureConfig.newInstance(AllureConfig.java:84)
[ERROR] at ru.yandex.qatools.allure.Allure.getVersion(Allure.java:266)
[ERROR] at ru.yandex.qatools.allure.Allure.fire(Allure.java:187)
[ERROR] at ru.yandex.qatools.allure.junit.AllureRunListener.testSuiteFinished(AllureRunListener.java:89)
[ERROR] at ru.yandex.qatools.allure.junit.AllureRunListener.testRunFinished(AllureRunListener.java:95)
[ERROR] at org.junit.runner.notification.SynchronizedRunListener.testRunFinished(SynchronizedRunListener.java:42)
[ERROR] at org.junit.runner.notification.RunNotifier$2.notifyListener(RunNotifier.java:103)
[ERROR] at org.junit.runner.notification.RunNotifier$SafeNotifier.run(RunNotifier.java:72)
[ERROR] at org.junit.runner.notification.RunNotifier.fireTestRunFinished(RunNotifier.java:100)
[ERROR] at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:131)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
[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/PluginExecutionException
Could anyone please help me in fixing this issue.Please note, i didnt do any changes to the code in the sample.
You need to add commons-beanutils to your dependencies.
after upgrading from 3.3.2 to Sonarqube 5.1.2, my maven build for a project that needs to be built with jdk 1.6 is failing with:
build 03-Dec-2015 19:33:10 [INFO] ------------------------------------------------------------------------
build 03-Dec-2015 19:33:10 [ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project my_project: Execution default-cli of goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar failed: An API incompatibility was encountered while executing org.codehaus.mojo:sonar-maven-plugin:2.6:sonar: java.lang.UnsupportedClassVersionError: org/sonar/api/utils/SonarException : Unsupported major.minor version 51.0
build 03-Dec-2015 19:33:10 [ERROR] -----------------------------------------------------
build 03-Dec-2015 19:33:10 [ERROR] realm = plugin>org.codehaus.mojo:sonar-maven-plugin:2.6
build 03-Dec-2015 19:33:10 [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
build 03-Dec-2015 19:33:10 [ERROR] urls[0] = file:/tmp/org/codehaus/mojo/sonar-maven-plugin/2.6/sonar-maven-plugin-2.6.jar
build 03-Dec-2015 19:33:10 [ERROR] urls[1] = file:/tmp/org/apache/maven/shared/maven-dependency-tree/2.1/maven-dependency-tree-2.1.jar
build 03-Dec-2015 19:33:10 [ERROR] urls[2] = file:/tmp/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
build 03-Dec-2015 19:33:10 [ERROR] urls[3] = file:/tmp/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar
build 03-Dec-2015 19:33:10 [ERROR] urls[4] = file:/tmp/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
build 03-Dec-2015 19:33:10 [ERROR] urls[5] = file:/tmp/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
build 03-Dec-2015 19:33:10 [ERROR] urls[6] = file:/tmp/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
build 03-Dec-2015 19:33:10 [ERROR] urls[7] = file:/tmp/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.jar
build 03-Dec-2015 19:33:10 [ERROR] urls[8] = file:/tmp/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
build 03-Dec-2015 19:33:10 [ERROR] urls[9] = file:/tmp/org/codehaus/sonar/runner/sonar-runner-api/2.4/sonar-runner-api-2.4.jar
build 03-Dec-2015 19:33:10 [ERROR] urls[10] = file:/tmp/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
build 03-Dec-2015 19:33:10 [ERROR] urls[11] = file:/tmp/com/google/guava/guava/10.0.1/guava-10.0.1.jar
build 03-Dec-2015 19:33:10 [ERROR] urls[12] = file:/tmp/com/google/code/findbugs/jsr305/2.0.3/jsr305-2.0.3.jar
build 03-Dec-2015 19:33:10 [ERROR] Number of foreign imports: 1
build 03-Dec-2015 19:33:10 [ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
build 03-Dec-2015 19:33:10 [ERROR]
build 03-Dec-2015 19:33:10 [ERROR] -----------------------------------------------------
build 03-Dec-2015 19:33:10 [ERROR] -> [Help 1]
seems like a compatibility issue, any ideas?
Pointing to the old sonar it still works fine, pointing to the new one, I get this.
Thanks,
Roberto
As you can read in the "Requirements" page or the "SonarQube 5.0 Upgrade Guide", you need at least Java 7 to run a SonarQube analysis.
You can always build (compile, test, ...etc) your project with Java 6, but then you need to configure your SonarQube analysis to use Java 7 or greater.
SonarQube 5.x requires java 7 to run the server and to run analysis.
It will still analyze projects build with java 6 but you should run the analysis with java 7.
I fell into almost the same problem running my Sonar analysis on Jenkins via maven. At some point a project analysis that worked started to fail while:
SonarQube Server had not changed (version 4.5.6)
Jenkins Job config had not changed (Maven Job configured with JDK 1.7.0.45)
Maven config had not changed
And this is what I got:
org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/sonarsource/scanner/maven/SonarQubeMojo : Unsupported major.minor version 52.0
17:27:29 [ERROR] -----------------------------------------------------
17:27:29 [ERROR] realm = plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.1.1
17:27:29 [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
17:27:29 [ERROR] urls[0] = file:/c:/tools/.m2/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.1.1/sonar-maven-plugin-3.1.1.jar
17:27:29 [ERROR] urls[1] = file:/c:/tools/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
17:27:29 [ERROR] urls[2] = file:/c:/tools/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
17:27:29 [ERROR] urls[3] = file:/c:/tools/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
17:27:29 [ERROR] urls[4] = file:/c:/tools/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
17:27:29 [ERROR] urls[5] = file:/c:/tools/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
17:27:29 [ERROR] urls[6] = file:/c:/tools/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
17:27:29 [ERROR] urls[7] = file:/c:/tools/.m2/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.7/sonar-scanner-api-2.7.jar
17:27:29 [ERROR] urls[8] = file:/c:/tools/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
17:27:29 [ERROR] urls[9] = file:/c:/tools/.m2/repository/com/google/code/findbugs/jsr305/2.0.3/jsr305-2.0.3.jar
17:27:29 [ERROR] Number of foreign imports: 1
17:27:29 [ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
The issue is caused here by a mismatch of java version between:
Jenkins Job executing with JDK 1.7.x
sonar-maven-plugin version 3.1.1 being compiled with JDK 1.8.x
The version of the plugin was not set explicitly in the pom.xml, so the analysis started to fail when the job took this version of the plugin.
For many reasons, the job JDK could not be upgraded to 1.8, so the version of the sonar-maven-plugin was fixed to 3.0.2.
This is correct, you need java 1.7 version. Make sure you have updated jdk version not the jre.
First verify which env variable to used to pick up jdk version.
javac -version
output:
Picked up _JAVA_OPTIONS: -Xmx512M
javac 1.7.0_80
Go to the command line and follow the below change.
Set JAVA_OPTIONS=C:\Program Files\Java\jdk1.7.0_80
or
Set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_80
set PATH=%JAVA_HOME%\bin;%PATH%