I'm using Jenkins ver.2.7.4.
I successfully launch sonar analyses from Jenkins by invoking top-level Maven targets sonar:sonar with SonarQube 5.1.2.
But when I upgrade SonarQube to version 6.4 I got this error when trying to launch a new build from Jenkins :
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project XXXX:
Can not execute SonarQube analysis: Plugin org.codehaus.sonar:sonar-maven3-plugin:6.4.0.25310 or one of its dependencies could not be resolved:
Failure to find org.codehaus.sonar:sonar-maven3-plugin:jar:6.4.0.25310 .......
It seems like you changed the version of the maven-plugin to 6.4. This is not correct.
The current version of the sonar scanner for maven is this:
<dependency>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.3.0.603</version>
</dependency>
It will work with recent versions of SonarQube, like SonarQube 6.4.
Related
I am facing issue in jenkins job(jenkins running docker) Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
I have checked java version in docker it is openjdk version "11.0.12" 2021-07-20
we can solve this in Android Studio but how can we solve while running gradle build in jenkins.
Below is the error I am getting
Build file '/var/jenkins_home/workspace/CICDDemo_master/app/build.gradle' line: 2
What went wrong:
An exception occurred applying plugin request [id: 'com.android.application']
Failed to apply plugin 'com.android.internal.application'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing org.gradle.java.home in gradle.properties.
In your Jenkins project choose the "configure" tab on the left side, then scroll down to "Properties Content" and write there:
JAVA_HOME=C:\Program Files\Java\jdk-11.0.12
GRADLE_USER_HOME=C:\
These are the final logs:
The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
Possible causes:
The project has not been built - the project must be built in between the begin and end steps
An unsupported version of MSBuild has been used to build the project. Currently MSBuild 14.0 upwards are supported
The begin, build and end steps have not all been launched from the same folder
None of the analyzed projects have a valid ProjectGuid and you have not used a solution (.sln)
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
Using:
TFS 2017 Update-2
VS2015
VSTS Task 3.2.0
SonarQube 5.6.6 LTS
After the upgrade of the SonarQube Extension from 4.0.2 to 4.1 We get a warning when running the "Scanner for MSBuild - End Analysis" task.
We noticed that the codecoverage.xml files are not generated by the Code Coverage Tool (see logging below).
This only appears for TFS agents with VS2015 installed, it works fine for the same setup with VS2017.
We applied the work-around: SonarQube Code Coverage from VSTS
we put /d:sonar.cs.vscoveragexml.reportsPaths=**/*.coveragexml in the additional setting of the task "Scanner for MSBuild - Begin Analysis"
But stil no codecoverage.xmlfiles are produced
Is there another workaround or solution ?
2018-03-21T10:01:20.7772938Z ##[section]Starting: Complete the SonarQube analysis
2018-03-21T10:01:20.7929236Z ==============================================================================
2018-03-21T10:01:20.7929236Z Task : Scanner for MSBuild - End Analysis
2018-03-21T10:01:20.7929236Z Description : [DEPRECATED] Use new version of the task
2018-03-21T10:01:20.7929236Z Version : 3.2.0
2018-03-21T10:01:20.7929236Z Author : SonarSource
2018-03-21T10:01:20.7929236Z Help : [More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
2018-03-21T10:01:20.7929236Z ==============================================================================
2018-03-21T10:01:20.7929236Z Preparing task execution handler.
2018-03-21T10:01:21.1835551Z Executing the powershell script: C:\TFS\Agent\_work\_tasks\SonarQubeScannerMsBuildEnd_6d01813a-9589-4b15-8491-8164aeb38055\3.2.0\SonarQubePostTest.ps1
2018-03-21T10:01:22.3867151Z WARNING: ------------------------------------------------------------------------
2018-03-21T10:01:22.3867151Z This executable is deprecated and may be removed in next major version of the SonarScanner for MSBuild. Please use 'SonarScanner.MSBuild.exe' instead.
2018-03-21T10:01:22.3867151Z ------------------------------------------------------------------------
2018-03-21T10:01:22.3867151Z SonarScanner for MSBuild 4.1
2018-03-21T10:01:22.3867151Z Using the .NET Framework version of the Scanner for MSBuild
2018-03-21T10:01:22.3867151Z Default properties file was found at C:\TFS\Agent\_work\_tasks\SonarQubeScannerMsBuildBegin_15b84ca1-b62f-4a2a-a403-89b77a063157\3.2.0\SonarQubeScannerMsBuild\SonarQube.Analysis.xml
2018-03-21T10:01:22.3867151Z Loading analysis properties from C:\TFS\Agent\_work\_tasks\SonarQubeScannerMsBuildBegin_15b84ca1-b62f-4a2a-a403-89b77a063157\3.2.0\SonarQubeScannerMsBuild\SonarQube.Analysis.xml
2018-03-21T10:01:22.3867151Z Post-processing started.
2018-03-21T10:01:22.3867151Z 11:01:21.761 11:01:21.746 WARNING: Failed to find the code coverage command line tool. Possible cause: Visual Studio is not installed, or the installed version does not support code coverage.
This issue is being tracked in #461 Failure to find VS2015 CodeCoverage.exe after searching for nonexistent registry key which lists the known workarounds (namely, manually add a registry key, or use VS2017 to build).
It should also work if the build agents have both VS2015 and VS2017 installed - the build can be performed using VS2015, but scanner end step should detect and use the VS2017 version of the code coverage tool.
I have tried to upgrade sonar-maven3-plugin to 5.0, when executing an analysis on the new 5.0 server. I received the following error:
[ERROR] Failed to execute goal org.codehaus.sonar:sonar-maven-plugin:5.0:sonar (default-cli) on project demo-issues: Please update sonar-maven-plugin to at least version 2.3 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.sonar:sonar-maven-plugin:5.0:sonar (default-cli) on project demo-issues: Please update sonar-maven-plugin to at least version 2.3 .
Looking at the release notes, it says: "[SONAR-5705] - Drop support of Maven 2". Not only drop, the Mojo directly throws an exception. The problem is that the old maven 3 plugin (the 5.0 version) still points to the maven2 one.
Is there any way to run an analysis with the 5.0 maven plugin?
As I explained on Which sonar-maven-plugin version to use?, the plugin you have to use is org.codehaus.mojo:sonar-maven-plugin, not the internal one(s). (So no need to try to upgrade sonar-maven3-plugin)
Your issue probably comes from the fact that the version of org.codehaus.mojo:sonar-maven-plugin has been locked down in your POM or parent POM.
I am trying to get files annotated with lombok.jar to compile with maven 3 using one of the Java 8 early access releases. I have maven configured to use the java 8 compiler. The code that I am compiling has a dependency defined for lombok 0.12 in maven central. However when I compile with maven I get the following error:
[ERROR] symbol: variable log
[ERROR] location: class Foo
[ERROR] C:.....\Foo.java:[319,33] error: cannot find symbol
I have run maven in debug mode and the classpath entry specified states that the lombok 0.12 jar file is in the classpath of the project. Additionally, I tried setting lombok.jar specifically in my classpath (and I can see in env.CLASSPATH in maven debug mode) which creates the same results.
Everything builds and compiles just fine in eclipse -- what am I doing wrong with the maven configuration/environment such that I can't get compilation to success outside of eclipse?
To answer my own question -- the issue is with the version of lombok (0.12.0) not working well with java 8. To fix, I used the cutting edge version of lombok , installed it into my local maven repo with the line
mvn install:install-file -Dfile=lombok-edge.jar -DgroupId=org.projectlombok -DartifactId=lombok-edge -Dversion=0.12.1 -Dpackaging=jar
and then changed the dependencies in my pom accordingly.
Once I did that, I was able to compile from command line maven.