Maven throws "Cannot find symbol" in Jenkins - maven

I'm creating a local instance for Jenkins and Sonarqube.
After creating project and after configuring the same, I clicked "Build Now".
In the console output I can see that Maven starts to download the required meta data and once that is completed it throws Compilation error "Cannot find symbol" for each of the file in the project.
Maven is also installed installed in my machine and, I tried downloading the project from GIT and ran maven via command prompt it builds successfully. Only if I build via Jenkins I'm getting this issue. Can someone please help me out with this.
Sonar Error
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project XXXXXXX: 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
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.codehaus.mojo:sonar-maven-plugin:2.6
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories /1/org/codehaus/mojo/sonar-maven-plugin/2.6/sonar-maven-plugin-2.6.jar
[ERROR] urls[1] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories/1/org/apache/maven/shared/maven-dependency-tree/2.1/maven-dependency-tree-2.1.jar
[ERROR] urls[2] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories/1/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[3] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories/1/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar
[ERROR] urls[4] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories/1/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[5] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories/1/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[6] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories/1/org/sonatype/plexus/plexus-sec-dispatcher/1.4/plexus-sec-dispatcher-1.4.jar
[ERROR] urls[7] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories/1/org/codehaus/plexus/plexus-utils/1.5.5/plexus-utils-1.5.5.jar
[ERROR] urls[8] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories/1/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[9] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories/1/org/codehaus/sonar/runner/sonar-runner-api/2.4/sonar-runner-api-2.4.jar
[ERROR] urls[10] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories/1/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] urls[11] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories/1/com/google/guava/guava/10.0.1/guava-10.0.1.jar
[ERROR] urls[12] = file:/C:/Program%20Files%20(x86)/Jenkins/maven-repositories/1/com/google/code/findbugs/jsr305/2.0.3/jsr305-2.0.3.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[project>com.XXXX.etl:XXXX:0.0.1-SNAPSHOT, parent: ClassRealm[maven.api, parent: null]]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] -> [Help 1]

Please specify the compilation version of Java. This is the reason why You are facing this issue - UnsupportedClassVersionError
try adding something like this in Your pom.xml
<build>
<plugins>
<!-- START Of Plugins -->
<!-- MAVEN COMPILER PLUGIN -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- END Of Plugins -->
</plugins>
</build>
Here I have used 1.7 jdk. But You can change that if required.
Please let know if it works...

I had the same error. The problem was that Jenkins service was running on JRE, even though JDK was configured in the system properly. To solve it, I had to stop Jenkins service, delete JRE, modify Jenkins XML to point to JDK, and then restart Jenkins service. Only then it worked.

Related

Quarkus project failed to build

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.

Error on releasing with maven-release-plugin on Jenkins

I got a Jenkins job that builds a java maven project.
Now I tried a release build via Jenkins (Perform Maven Release) but it fails.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project MyProject: Unable to check for local modifications
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] svn: E155036: Please see the 'svn upgrade' command
[ERROR] svn: E155036: The working copy at '/var/lib/hudson/workspace/JobName/MyProject'
[ERROR] is too old (format 8) to work with client version '1.9.5 (r1770682)' (expects format 31). You need to upgrade the working copy first.
[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/MojoFailureException
The plugin configuration in the pom is:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5</version>
<configuration>
<tagBase>http://svn.example.org/myproject/tags/_modules</tagBase>
</configuration>
</plugin>
I'm not sure now but in the past it was working.
What I don't understand is the maven-release-plugin not using the local svn client?
From the error message it seems so (svn upgrade) and if so why is it failing on the release but not the checkout?
Is there a way to come around this without changing jenkins?
What I tried is adding following as I understand that that should force the plugin to use this provider which should be compatible:
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>2.0.6</version>
<scope>compile</scope>
</dependency>
</dependencies>
But I got following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project MyApp: Unable to commit files
[ERROR] Provider message:
[ERROR] SVN commit failed.
[ERROR] Command output:
[ERROR] svn: E170001: Commit failed (details follow):
[ERROR] svn: E170001: MKACTIVITY of '/products/MyAppsAgregator/!svn/act/24d46a73-6601-0010-864c-7b76c8107c40': 403 Forbidden (http://svn.example.org)
[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.

Sonar scanner with Maven and JDK 11

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.

Sonar 3.5.1 not working for Java 8 and maven 3.3.9 with war file

We are upgrading and existing project to java 8 and maven 3.3.9 we have sonar 3.5.1, though latest versions of sonar are available we don't want to update sonar since we have done some customization in sonar 3.5.1.
Main thing is that we deploy sonar war in the same tomcat where we
have deployed our project but in new sonar versions war folder is
deleted and they have provided separate sonar server which we don't
want.
So please help me to run sonar 3.5.1 or tell me how can I make war of latest sonar version and deploy it in my own tomcat. I am trying this from last two days and tested with different versions but no success. When using sonar 3.5.1 we are getting below error
[INFO] Sonar version: 3.5.1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.007 s
[INFO] Finished at: 2017-04-26T23:47:34+05:30
[INFO] Final Memory: 24M/218M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project app25apr1: Execution default-cli of goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar failed: A required class was missing while executing org.codehaus.mojo:sonar-maven-plugin:2.0:sonar: org/sonatype/aether/graph/DependencyFilter
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.codehaus.mojo:sonar-maven-plugin:2.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/ist/innoeye/headStart8Repository/org/codehaus/mojo/sonar-maven-plugin/2.0/sonar-maven-plugin-2.0.jar
[ERROR] urls[1] = file:/home/ist/innoeye/headStart8Repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
[ERROR] urls[2] = file:/home/ist/innoeye/headStart8Repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[3] = file:/home/ist/innoeye/headStart8Repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[4] = file:/home/ist/innoeye/headStart8Repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[5] = file:/home/ist/innoeye/headStart8Repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[6] = file:/home/ist/innoeye/headStart8Repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[7] = file:/home/ist/innoeye/headStart8Repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[8] = file:/home/ist/innoeye/headStart8Repository/org/codehaus/plexus/plexus-utils/2.0.4/plexus-utils-2.0.4.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.sonatype.aether.graph.DependencyFilter
Sonar 3.5.1 is 4 years old. I highly suggest to use latest LTS (5.6.6) which is working with Java 8 and maven 3.3.9.
If you don't want to upgrade due to your customizations, I don't know if you will be able to analyse your projects.

org/sonar/api/utils/SonarException : Unsupported major.minor version 51.0

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%

Resources