Maven can't resolve sonar-maven-plugin version 5.1.2 - jenkins

We have Sonar and Jenkins located on the same machine, and Sonar analysis is run as Jenkins job post step. Jenkins jobs are built with Maven 3.0.5.
Everything was fine until we updated Sonar from 4.5.x to 5.1.2 yesterday.
After update sonar step failed with exception:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project TestApplication: Can not execute Sonar
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
Caused by: org.apache.maven.plugin.PluginResolutionException: Plugin org.codehaus.sonar:sonar-maven3-plugin:5.1.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.sonar:sonar-maven3-plugin:jar:5.1.2
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.codehaus.sonar:sonar-maven3-plugin:jar:5.1.2
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Failure to find org.codehaus.sonar:sonar-maven3-plugin:pom:5.1.2 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
We figured out that there is actually 5.1 version of org.codehaus.sonar:sonar-maven3-plugin, but no 5.1.2 in maven repo.
Fix:
We managed to fix it with forcing org.codehaus.mojo:sonar-maven-plugin version to 2.6 through in our pom file, as advised on official Analyzing with Sonar doc
But since we have dozens of projects, there should be better solution rather than changing every single project's pom files

Ok, simple solution found:
In the maven repository (.m2) it was cached that latest version of org.codehaus.mojo:sonar-maven-plugin is 2.0, even though the latest one is 2.6. (in file .m2/repository/org/codehaus/mojo/sonar-maven-plugin/maven-metadata-central.xml)
The old version differs a lot from the new one in the way it works (see Which sonar-maven-plugin version to use?)
We removed .m2/repository/org/codehaus/mojo/sonar-maven-plugin directory, so that newer version is downloaded.

Related

Jenkins upgrade from 1.6xx to 2.xx (1.642.3 -> 2.32.2)

I upgraded Jenkins to 2.32.3 version (in place upgrade) after taking necessary backups (THIN) or $JENKINS_HOME and Jenkins is now UP and running.
Under Manage Jenkins > Manage Plugins, I see the following RED error:
Manage Jenkins
Correct
There are dependency errors loading some plugins:
Environment Injector Plugin v2.1.3
envinject-api v1.2 is missing. To fix, install v1.2 or later.
While trying to install Environment Inject Plugin 2.1.3, the logs (during download/install) shows the same error:
Installing Plugins/Upgrades
Preparation
Checking update center connectivity
Success
Environment Injector Plugin
Failure -
java.io.IOException: Failed to dynamically deploy this plugin
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1895)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1652)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Failed to install envinject plugin
at hudson.PluginManager.dynamicLoad(PluginManager.java:873)
at hudson.PluginManager.dynamicLoad(PluginManager.java:813)
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1891)
... 5 more
Caused by: java.io.IOException: Environment Injector Plugin v2.1.3 failed to load.
- envinject-api v1.2 is missing. To fix, install v1.2 or later.
at hudson.PluginWrapper.resolvePluginDependencies(PluginWrapper.java:621)
at hudson.PluginManager.dynamicLoad(PluginManager.java:863)
... 7 more
Where can I get this envinject-api 1.2 plugin? Should I go grab the Github project (clone it) and build the Maven project and put the hpi file under $JENKINS_HOME/plugins folder?
Under Available plugins tab, I don't see an option to select a given version (only 2.1.3 is available). I don't see envinject-api 1.2 plugin listed there either that I can select. My understanding it, selecting Environment Inject 2.1.3 should auto grab all of its dependent plugins for free per it's MANIFEST file.
$ cat $JENKINS_HOME/plugins/envinject/META-INF/MANIFEST.MF
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: nenashev
Build-Jdk: 1.8.0_121
Extension-Name: envinject
Specification-Title: The Jenkins Plugins Parent POM Project
Implementation-Title: envinject
Implementation-Version: 2.1.3
Plugin-Class: org.jenkinsci.plugins.envinject.EnvInjectPlugin
Group-Id: org.jenkins-ci.plugins
Short-Name: envinject
Long-Name: Environment Injector Plugin
Url: https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin
Compatible-Since-Version: 2.0
Plugin-Version: 2.1.3
Hudson-Version: 1.625.3
Jenkins-Version: 1.625.3
Plugin-Dependencies: envinject-api:1.2,ivy:1.21;resolution:=optional,m
atrix-project:1.7,script-security:1.22
Plugin-Developers: Gregory Boissinot:gbois:gregory.boissinot#gmail.com
,Oleg Nenashev:oleg_nenashev:o.v.nenashev#gmail.com,Manuel Recena:rec
ena:recena#gmail.com
For some reason Jenkins plugins (didn't download the dependent plugins per the Manifest file).
As envinject-api plugin was not listed in the AVAILABLE plugin tab (under Manage Jenkins > Manage Plugins section), I had to manually download the .hpi / .jpi file directly from the following download plugins URL and then I placed the file in $JENKINS_HOME/plugins folder.
https://updates.jenkins-ci.org/download/plugins/
wget https://updates.jenkins-ci.org/download/plugins/envinject-api/1.2/envinject-api.hpi
Restarted Jenkins sudo service jenkins restart (or any other way you have setup) and this issue went away from both Jenkins GUI and from tail -f /var/log/jenkins/jenkins.log
PS: Don't just randomly select a latest version of any plugin or it's dependent plugin. It may not work and break more other plugins as it depends upon your current Jenkins version.
Found this link for Juseppe, not sure how relevant is this but seems interesting: https://github.com/yandex-qatools/juseppe

Sonar Failure because of org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectory(Lorg/sonar/api/resources/Project;)Ljava/io/File;

I have couple of groovy/ grails projects and i am using sonar-runner to analyze them. They worked perfectly until today I started receiving this error :
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: org.sonar.plugins.surefire.api.SurefireUtils.getReportsDirectory(Lorg/sonar/api/resources/Project;)Ljava/io/File;
Not sure whats this, if somebody has experience this error before pls let me know
I had the same problem. The sonar-surefire-plugin-1.5.jar in your sonar/extensions.plugins/ directory I believe is the problem. I upgraded that to the 3.3.2 version from the maven repository; http://mvnrepository.com/artifact/org.codehaus.sonar.plugins/sonar-surefire-plugin, then restarted sonar and everything worked. I am running the sonar-groovy-plugin-1.0-SNAPSHOT from cloud bees but I had the problem with their jar as well.
Hmm... I had the same problem after installin of sonar 3.7.3 (the latest) Before it I have used sonar 3.5.X and all were OK. As possible solution: install previous version (3.6.X)
There's a compatibility issue between Java Plugins 1.5 and Groovy 0.6 (and also Flex 1.2). Related JIRA tickets: http://jira.codehaus.org/browse/SONARPLUGINS-3178 and http://jira.codehaus.org/browse/SONARPLUGINS-3259. Compatibility matrix updated: http://docs.codehaus.org/display/SONAR/Plugin+version+matrix

Failed to read artifact descriptor for with SpringRoo

I am very new to SpringRooSuit tool.I installed that exe 3.3 release .And I started to create the project .When building my project Its giving the error below:
Errors occurred during the build.
Errors running builder 'Maven Project Builder' on project 'HelloWorld'.
Could not calculate build plan: Plugin org.codehaus.mojo:aspectj-maven-plugin:1.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:aspectj-maven-plugin:jar:1.4
Plugin org.codehaus.mojo:aspectj-maven-plugin:1.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:aspectj-maven-plugin:jar:1.4
My first Question is Do we need to setup the Maven for this?I think maven should hace Embeeded in this exe only. I am new to Maven also.
If maven has to integrate with STS IDE how to do this...??
Please help me...
Came across this issue today so I thought I add exactly what I changed to help anyone else
Changed this from
<aspectj.version>1.7.2</aspectj.version>
to
<aspectj.version>1.7.3</aspectj.version>
and changed
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
to
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.5</version>
Project now builds

Failure in maven site plugin version 3?

I am trying to get a project to run the maven site:site goal using Maven 3.0.4. Unbeknownst to me, it had been running under Maven 2.2.1 (when I thought it should have been 3).
I keep getting the following failure:
Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0:site (default-cli) on project myproj-parent: Execution default-cli of goal org.apache.maven.plugins:maven-site-plugin:3.0:site failed: For artifact {null:null:null:jar}: The groupId cannot be empty.
How do I even find what artifact is missing groupId?
It turns out the POM file for one of my dependencies was corrupt. The POM for joda-jsptags-1.0.2 in our Nexus repository wasn't a POM, but a fragment of HTML.
Getting a clean version of joda-jsptags fixed this issue.
It was just frustrating not to get any sort of idea what was bad. And apparently the Maven 3 plugins are more strict on POM parsing.
If you are migrating from Maven 2.2.1 to Maven 3.0.4 you have to be aware of some difference in particular in relation with site generation. You should have taken a look the the migration docs and take a look if your pom needed to be fixed.
Missed a link.

SAXParseException Using Maven-JAXB2 0.7.5 Plugin, Only On Maven 3

I seem to be having issues with the maven-jaxb2-plugin (Version 0.7.5) when using Maven 3. The issue doesn't occur when using Maven 2.2.x, and it only became an issue when I upgraded to Maven 3.
Following is the maven output after executing mvn clean test:
[ERROR] Error while parsing schema(s).Location
[ file:/C:/dev/smart-07-2011/mpg-money-send-service/src/main/resources/META-INF/mpg/schemas/XRSIMoneySend.xsd{218,45}].
org.xml.sax.SAXParseException: src-resolve:
Cannot resolve the name 'common:ResponseBody' to
a(n) 'type definition' component.
However, the tests execute fine when using Maven 2. I've been searching for resources online if there's any known issue between Maven 3 and JAXB2, but I couldn't find any resources. Effective POM for the build using Maven 2 or Maven 3 is identical.
Incidentally, in the past I was able to use the maven-jaxb2-plugin on Maven 3 just fine; this build, however is special in that the XSD is in a dependent JAR, so it could be a configuration issue; but I'm not sure what configuration I would need to set in the POM or bindings.
Are there any resources I could use to resolve this issue, or any resolution steps I could take? Thanks a lot!

Resources