Why valid version of maven-sonar-plugin couldn't be found? - maven

We are using maven 2.2.1 and the compatible sonar-maven-plugin is 1.0, Sonarqube 4.0
Sometimes the builds are getting failed and when we checked the logs, we have come across with this strange error
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'sonar'.
[INFO] org.apache.maven.plugins: checking for updates from central
[INFO] org.apache.maven.plugins: checking for updates from snapshots
[INFO] org.codehaus.mojo: checking for updates from central
[INFO] org.codehaus.mojo: checking for updates from snapshots
[INFO] artifact org.apache.maven.plugins:maven-sonar-plugin: checking for updates from central
[INFO] artifact org.apache.maven.plugins:maven-sonar-plugin: checking for updates from snapshots
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-sonar-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: The plugin 'org.apache.maven.plugins:maven-sonar-plugin' does not exist or no valid version could be found
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1851)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:462)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:175)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.version.PluginVersionNotFoundException: The plugin 'org.apache.maven.plugins:maven-sonar-plugin' does not exist or no valid version could be found
at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:229)
at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:91)
at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:179)
at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540)
... 15 more
so we went to the location org/codehaus/mojo and then found that the maven-metadata-central.xml has the below content.
xml version="1.0" encoding="UTF-8"?
<metadata />
that is there is nothing mentioned about sonar-maven-plugin in the xml file , Prefix: sonar etc...
Tried doing the below:
We added that(sonar-maven-plugin, prefix) in the xml files(central and snapshot), saved it and relaunched the build, then the build got success for 2days.
Now Again the same error appears!!!
According to me some file/program is modifying this xml file.
could anyone tell me what is that file that is modifying that xml ?
And also why is the data in that xml erased? does it happen everytime the job is triggered?
Does artifactory has anything to do with this?
Thanks in advance.

You're certainly facing an issue which relates to http://jira.codehaus.org/browse/MNG-4001 (see Sonar FAQ [1]).
delete the org/codehaus/mojo directory from .m2 repository as well as remote repository from which it is downloading.
http://comments.gmane.org/gmane.comp.java.sonar.general/5010
hope this helps.

Related

why maven-sonar-plugin doesnot exist?

I am facing a similar issue as in https://issues.apache.org/jira/browse/MNG-4001
but with maven-sonar-plugin. Versions i am using are:
Jenkins - 1.580.1, SonarQube-plugin in Jenkins -2.1, tried with Sonar 4.0 and SonarQube 4.5.1 but faced same error, sonar-maven-plugin: 2.6 /2.7.1 (tried both) I face this error when i use Sonar post build step in my Jenkins configuration and this is frequent issue seen in different jobs
Error is
[INFO] Searching repository for plugin with prefix: 'sonar'.
[INFO] artifact org.apache.maven.plugins:maven-sonar-plugin: checking for updates from central
[INFO] artifact org.apache.maven.plugins:maven-sonar-plugin: checking for updates from snapshots
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-sonar-plugin' does not exist or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: The plugin 'org.apache.maven.plugins:maven-sonar-plugin' does not exist or no valid version could be found
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1851)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:462)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:175)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.version.PluginVersionNotFoundException: The plugin 'org.apache.maven.plugins:maven-sonar-plugin' does not exist or no valid version could be found
at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:229)
at org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:91)
at org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:179)
at org.apache.maven.plugin.DefaultPluginManager.loadPluginDescriptor(DefaultPluginManager.java:1642)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1540)
... 15 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Dec 16 13:13:35 CET 2015
[INFO] Final Memory: 7M/238M
[INFO] ------------------------------------------------------------------------
Sonar analysis completed: FAILURE
Build step 'Sonar' changed build result to FAILURE
Build step 'Sonar' marked build as failure
Finished: FAILURE
why am i facing this error ? is the issue(bug) with Sonarqube plugin in Jenkins?
for time being to avoid this error i have deleted Sonar post build step and added the sonar analysis step in maven goals for maven 3.0.4
Maven goals :: clean install -Dmaven.test.skip=true -Dsonar.jdbc.url=jdbc:postgresql://sonardb.test.com:5555/sonar -Dsonar.host.url=http://localhost:9000/sonar org.codehaus.mojo:sonar-maven-plugin:2.6:sonar <br>
but this is a temporary solution, I would like to use Sonar post build step in my job configuration and not face this error.
Thanks for your help
SonarQube FAQ recommends the following:
If you get this error message after launching the maven command line "mvn sonar:sonar" add the "-U" parameter to the command line. Maven will then update its local repository with the latest version of the Sonar Maven plugin.
If adding the "-U" parameter doesn't fix your issue, you've certainly encountered Maven bug MNG-4001. The only known workaround is to delete the org\codehaus\mojo directory in your local Maven repository. Of course, if your local Maven repository is synchronized with a repository manager like Nexus, this operation must be also done on the repository manager side.
The problem is simply cause you are using the wrong coordinates of the plugin:
'org.apache.maven.plugins:maven-sonar-plugin'
The sonar-maven-plugin is not part of Apache Software Foundation.
You will find it here:
http://www.mojohaus.org/sonar-maven-plugin/
And how to use it here:
http://www.mojohaus.org/sonar-maven-plugin/plugin-info.html

Jenkins/Maven build dying with "Could not find the selected project in the reactor" error

I’m using Jenkins on the Cloudbees build service and nave a multi-module Maven project. Recently, we removed a project from our parent pom, however, when we run the build in Jenkins with the following options …
clean install -e -P qa -P cloudbees -DskipITs
The artifacts are automatically stored into a Cloudbees snapshot repository attached to our account. However, the build ultimately fails with the below “Could not find the selected project in the reactor: org.mainco.subco:oldmodule” error. Is there a way to force the build to
[subco] $ mvn initialize -N
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building subco 76.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.841s
[INFO] Finished at: Fri Feb 27 21:59:22 UTC 2015
[INFO] Final Memory: 5M/115M
[INFO] ------------------------------------------------------------------------
Parsing POMs
Modules changed, recalculating dependency graph
maven31-agent.jar already up to date
maven31-interceptor.jar already up to date
maven3-interceptor-commons.jar already up to date
[subco] $ /opt/jdk/jdk1.7.0/bin/java -Dmaven.test.failure.ignore=false -cp /scratch/jenkins/maven31-agent.jar:/opt/maven/apache-maven-3.1.1/boot/plexus-classworlds-2.5.1.jar:/opt/maven/apache-maven-3.1.1/conf/logging jenkins.maven3.agent.Maven31Main /opt/maven/apache- maven-3.1.1 /scratch/jenkins/slave.jar /scratch/jenkins/maven31-interceptor.jar /scratch/jenkins/maven3-interceptor-commons.jar 52053
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /scratch/jenkins/workspace/subco/subco/pom.xml -amd -pl org.mainco.subco:oldmodule,org.mainco.subco:subco,org.mainco.subco:moduleB,org.mainco.subco:database,org.mainco.subco:moduleF,org.mainco.subco:moduleA,org.mainco.subco:moduleH,org.mainco.subco:newmodule,org.mainco.subco:session,org.mainco.subco:moduleA,org.mainco.subco:newmodule,org.mainco.subco:moduleB clean install -e -P qa -P cloudbees -DskipITs
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.mainco.subco:moduleA:jar:76.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-antrun-plugin # line 508, column 12
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.mainco.subco:newmodule:jar:76.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:aspectj-maven-plugin is missing. # line 200, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[ERROR] Could not find the selected project in the reactor: org.mainco.subco:oldmodule -> [Help 1]
org.apache.maven.MavenExecutionException: Could not find the selected project in the reactor: org.mainco.subco:oldmodule
at org.apache.maven.DefaultMaven.trimSelectedProjects(DefaultMaven.java:750)
at org.apache.maven.DefaultMaven.createDependencyGraph(DefaultMaven.java:704)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:287)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
at hudson.remoting.UserRequest.perform(UserRequest.java:121)
at hudson.remoting.UserRequest.perform(UserRequest.java:49)
at hudson.remoting.Request$2.run(Request.java:324)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Take a look at what Maven is executing:
Executing Maven: -B -f /scratch/jenkins/workspace/subco/subco/pom.xml -amd -pl org.mainco.subco:oldmodule,org.mainco.subco:subco,org.mainco.subco:moduleB,org.mainco.subco:database,org.mainco.subco:moduleF,org.mainco.subco:moduleA,org.mainco.subco:moduleH,org.mainco.subco:newmodule,org.mainco.subco:session,org.mainco.subco:moduleA,org.mainco.subco:newmodule,org.mainco.subco:moduleB clean install -e -P qa -P cloudbees -DskipITs
In the -pl part is your old module. As you tell maven to use the parent project to build a module that's no longer part of that project, it fails.
Where is that command generated? Is suspect the old module be in one of your maven profiles or the Jenkins configuration.

Magnolia archetype can't resolve info.magnolia.ui:magnolia-ui-project:pom:5.3

I'm trying to use maven archetype to create a Magnolia project by running:
D:\workingFolder\workspace\MagnoliaTutorial5.3\tryProjects> mvn archetype:generate -DarchetypeCatalog=http://nexus.magnolia-cms.com/content/groups/public/
and choose
5: http://nexus.magnolia-cms.com/content/groups/public/ -> info.magnolia.maven.archetypes:magnolia-project-archetype (An arch
etype to create a Magnolia project (a parent pom and a webapp))
and configure the properties as follow:
Confirm properties configuration:
groupId: com.try.projects
artifactId: tryProjects
version: 1.0-SNAPSHOT
package: com.try.projects
magnolia-version: 5.3
project-name: tryProjects
project creation is successful but when I run
mvn clean install
I run into following problem:
[INFO] Error building POM (may not be this project's POM).
Project ID: info.magnolia.ui:magnolia-ui-project
Reason: POM 'info.magnolia.ui:magnolia-ui-project' not found in repository: Unable to download the artifact from any reposito
ry
info.magnolia.ui:magnolia-ui-project:pom:5.3
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
for project info.magnolia.ui:magnolia-ui-project
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: POM 'info.magnolia.ui:magnolia-ui-project' not found in repository: Unable
to download the artifact from any repository
info.magnolia.ui:magnolia-ui-project:pom:5.3
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
for project info.magnolia.ui:magnolia-ui-project
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.ProjectBuildingException: POM 'info.magnolia.ui:magnolia-ui-project' not found in reposit
ory: Unable to download the artifact from any repository
info.magnolia.ui:magnolia-ui-project:pom:5.3
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
for project info.magnolia.ui:magnolia-ui-project
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:605)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:251)
at org.apache.maven.project.DefaultMavenProjectBuilder.mergeManagedDependencies(DefaultMavenProjectBuilder.java:1456)
at org.apache.maven.project.DefaultMavenProjectBuilder.processProjectLogic(DefaultMavenProjectBuilder.java:999)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:880)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:255)
at org.apache.maven.project.DefaultMavenProjectBuilder.mergeManagedDependencies(DefaultMavenProjectBuilder.java:1456)
at org.apache.maven.project.DefaultMavenProjectBuilder.processProjectLogic(DefaultMavenProjectBuilder.java:999)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:880)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:50
8)
at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:604)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:487)
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:391)
... 12 more
Caused by: org.apache.maven.artifact.resolver.ArtifactNotFoundException: Unable to download the artifact from any repository
info.magnolia.ui:magnolia-ui-project:pom:5.3
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:228)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:90)
at org.apache.maven.project.DefaultMavenProjectBuilder.findModelFromRepository(DefaultMavenProjectBuilder.java:558)
... 25 more
Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: Unable to download the artifact from any repository
at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:404)
at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:216)
... 27 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Sun Jul 20 22:47:32 SGT 2014
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------
I tried to use earlier version 5.1.1 this problem is not occurred. looks like something wrong for the repository but I can't figure out the solution for this.
Any ideal how I can fix this problem?
Magnolia's modules are located in their own maven repository, so you need to add this one to your settings.xml.
The following command can be executed from a terminal in your .m2 repository (usually <user-dir>/.m2) and will download a settings.xml file preconfigured for Magnolia CE:
mvn org.sonatype.plugins:nexus-maven-plugin:1.9.2.4:settings-download -Dnexus.url=http://nexus.magnolia-cms.com -Dsettings.templateId=magnolia-community-public
You will only need to do this step once. After that, maven knows Magnolia's maven repo.
Documentation: http://documentation.magnolia-cms.com/display/DOCS/Maven+init
https://wiki.magnolia-cms.com/display/DEV/Maven+setup
for CE users, you need to use the following command in .m2 folder:
mvn org.sonatype.plugins:nexus-m2settings-maven-plugin:1.6.5:download -DnexusUrl=https://nexus.magnolia-cms.com -Dusername=anonymous -Dpassword=anonymous -DtemplateId=magnolia-community-public

Jenkins-Sonar-Maven Integration Issue

I have been trying to integrate Sonar with our Jenkins continous Integration system. I have installed the Sonar-plugin for Jenkins and configured it(specified the DB, DB Username and password etc). I have also specified the sonar-maven-plugin version as 1.0-beta-2.
Along with this plugin configuration, I have added a build post-action to run Sonar on my maven projects. But everytime Jenkins tries to execute sonar:sonar goal it fails with the below error.
Please help me guys in resolving this problem.
Thanks
[INFO] Building prof
[INFO] task-segment: [org.codehaus.mojo:sonar-maven-plugin:1.0-beta-2:sonar] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [sonar:sonar {execution: default-cli}]
[INFO] Sonar host: http://inmqbs:9000
[INFO] Sonar version: 3.3.2
[INFO] Execute: org.codehaus.sonar:sonar-maven-plugin:3.3.2:sonar
Downloading: http://troop:8081/nexus/content/groups/platform//org/codehaus/sonar/sonar-maven- plugin/3.3.2/sonar-maven-plugin-3.3.2.pom
[INFO] Unable to find resource 'org.codehaus.sonar:sonar-maven-plugin:pom:3.3.2' in repository troop-maven-releases (http://troop:8081/nexus/content/groups/platform/)
Downloading: http://troop:8081/nexus/content/groups/platform//org/codehaus/sonar/sonar-maven-plugin/3.3.2/sonar-maven-plugin-3.3.2.pom
[INFO] Unable to find resource 'org.codehaus.sonar:sonar-maven-plugin:pom:3.3.2' in repository central (http://repo1.maven.org/maven2)
Downloading: http://troop:8081/nexus/content/groups/platform//org/codehaus/sonar/sonar-maven-plugin/3.3.2/sonar-maven-plugin-3.3.2.pom
[INFO] Unable to find resource 'org.codehaus.sonar:sonar-maven-plugin:pom:3.3.2' in repository troop-maven-releases (http://troop:8081/nexus/content/groups/platform/)
Downloading: http://troop:8081/nexus/content/groups/platform//org/codehaus/sonar/sonar-maven-plugin/3.3.2/sonar-maven-plugin-3.3.2.pom
[INFO] Unable to find resource 'org.codehaus.sonar:sonar-maven-plugin:pom:3.3.2' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar
Embedded error: Unable to build project for plugin 'org.codehaus.sonar:sonar-maven-plugin': POM 'org.codehaus.sonar:sonar-maven-plugin' not found in repository: Unable to download the artifact from any repository
org.codehaus.sonar:sonar-maven-plugin:pom:3.3.2
from the specified remote repositories:
internal-repository (http://troop:8081/nexus/content/groups/platform/)
for project org.codehaus.sonar:sonar-maven-plugin
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals (DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal (DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal (DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:103)
at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:79)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:88)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals (DefaultLifecycleExecutor.java:694)
... 17 more
The problem clearly comes from your Nexus repository or from some specific configuration that you've made in your POM / settings.xml file / Jenkins settings. You should contact the guys who handle this "http://troop:8081" Nexus instance to know how to deal with your issue.
BTW, there's no need to force the version of the sonar-maven-plugin plugin: this will cause you only troubles.
what database are you using?, if it defaults to derby database then only connections from the localhost are allowed and thus sonar and jenkins should run in the same machine. If this is the problem i can give further guidance but in a nutshell either change the database, or change the derby connection properties or provide a ssh tunnel between sonar and jenkins machines.
Use in the your configuration sonar-maven-plugin 2.0-beta-1
instead sonar-maven-plugin:1.0-beta-2

Trying to compile mahout but getting error - Cannot execute mojo: resources. Build is not using pom.xml

I have completed the following steps:
Installed Java 1.6
I am using Ubuntu 11.10. Added the $JAVA_HOME path in /etc/bash.bachrc
Installed maven. mvn --version is showing the installed maven correctly.
Downloaded Mahout from http://svn.apache.org/repos/asf/mahout/trunk
Now, I go inside mahout/trunk and try to do mvn clean install or mvn clean install -X -e, then it gives the follwoing error -
Cannot execute mojo: resources. It requires a project with an existing
pom.xml, but the build is not using one.
I just want to try the examples in the mahout/examples. How to fix this error?
There is a pom.xml in the directory.
Full terminal output is here:
+ Error stacktraces are turned on.
Apache Maven 2.2.1 (rdebian-6)
Java version: 1.6.0_23
Java home: /usr/lib/jvm/java-6-openjdk/jre
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux" version: "3.0.0-16-generic" arch: "i386" Family: "unix"
[DEBUG] Building Maven user-level plugin registry from: '/home/kartikeya/.m2/plugin-registry.xml'
[DEBUG] Building Maven global-level plugin registry from: '/usr/share/maven2/conf/plugin-registry.xml'
[INFO] Scanning for projects...
[DEBUG] Wagons could not be registered as the extension container was never created
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[DEBUG] Retrieving parent-POM: org.apache.maven.plugins:maven-plugins:pom:12 for project: null:maven-clean-plugin:maven-plugin:2.3 from the repository.
[DEBUG] Retrieving parent-POM: org.apache.maven:maven-parent:pom:9 for project: org.apache.maven.plugins:maven-plugins:pom:12 from the repository.
[DEBUG] Retrieving parent-POM: org.apache:apache:pom:4 for project: org.apache.maven:maven-parent:pom:9 from the repository.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one.
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot execute mojo: clean. It requires a project with an existing pom.xml, but the build is not using one.
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:414)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Mar 21 11:32:36 IST 2012
[INFO] Final Memory: 2M/55M
[INFO] ------------------------------------------------------------------------
Thank you ajozwik and Owen.
I installed maven2 from the aptitude. I took the following steps to fix this issue:
Removed Maven2 sudo apt-get remove maven2
Installed Maven 3.0.4 for ubuntu as directed in - Installing maven2 without openjdk
Even after doing this, I got the error -
Unable to locate the javac Compiler in:[ERROR] /usr/lib/jvm/java-6-openjdk/jre/../lib/tools.jar
To fix this, JDK needs to be reinstalled. It worked for me!. For those even, if this solution doesn't work, please have a look at - Why maven ignores my JAVA_HOME?
Regards.
"Cannot execute mojo: resources. It requires a project with an existing pom.xml"
This error means there is not pom.xml in the working directory

Resources