Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sonar requires a project with an existing pom.xml, but the build is not using one

 
Arka Sharma
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,
I have installed sonar 1.6.1 plugin in hudson-2.1.I'm using SVN.The maven build was successful.I have added following in my "pom.xml"
"<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven</artifactId>
<version>1.0-beta-2</version>
</plugin>"
Now the path of ROOT pom is "SVN_URL/project_name/pom.xml".In sonar.properties file dbuser - sonar password - sonar I'm using MySQL so corresponding settings I have changed.But from browser I'm unable to display any thing at "http://localhost:9000".Finally in hudson build is successful but finally it shows following exception\

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Cannot execute mojo: sonar. It requires a project with an existing pom.xml, but the build is not using one.
[INFO] ------------------------------------------------------------------------
[INFO] Trace

org.apache.maven.lifecycle.LifecycleExecutionException: Cannot execute mojo: sonar. 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.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: Cannot execute mojo: sonar. 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



 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error "It requires a project with an existing pom.xml, but the build is not using one." means that there is no pom.xml file in the current directory, nor was the -f option provided to tell mvn which pom.xml file to use.

You post is somewhat confusing, not sure what it is you are saying. I gather than the failed build was started by Hudson. If that is true, if you checkout your project from Subversion onto your local machine, cd into the project directory, and then run mvn, what happens? Let's get that working first before we tackle what went wrong in Hudson.
 
Arka Sharma
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


My project is located in svn.I checked in after I added plug in in project's parent pom.xml. Now in Hudson what should be the path of root pom.I tried with SVN_URL/PROJECT_NAME/pom.xml I also added -f ./pom.xml in the additional properties field.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I set Root POM to: pom.xml

You mentioned a parent POM. For your Hudson job, exactly what are you checking out? Only the project you are building, or the project that contains the parent POM? It might help if you did a "svn co xxx" where xxx is the Repository URL you specified for your job in Hudson, and post the list of files that were checked out. Actually, I am interested on in the pom.xml files that get checked out, so you don't have to post the rest of the files. Also, identify the pom.xml you are trying to use for the build.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic