开发者

Ant Build passes but Sonar build fails!

I am using Sonar 开发者_开发百科new version with Ant build connectint to Hudson.

I get following error in the console.

The build gets success but at the end it gives a failure on maven! i am only using Sonar-Ant Target. I am not doing anything with pom.

[sonar:sonar] [INFO] Database optimization done: 421 ms BUILD SUCCESSFUL Total time: 49 seconds [workspace] $ mvn.bat -f "C:\Documents and Settings\hegdera.hudson\jobs\ZOOR2\workspace\pom.xml" -e -B sonar:sonar -Dsonar.host.url=http://localhost:8001 + Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'sonar'. [INFO] Ignoring available plugin update: 2.0-beta-2 as it requires Maven version 3.0 [INFO] Ignoring available plugin update: 2.0-beta-1 as it requires Maven version 3.0 [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [sonar:sonar] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] ------------------------------------------------------------------------ [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 [INFO] ------------------------------------------------------------------------ [INFO] Total time: < 1 second [INFO] Finished at: Fri Jul 15 17:37:18 GMT+05:30 2011 [INFO] Final Memory: 2M/15M [INFO] ------------------------------------------------------------------------ Finished: FAILURE

Anyone help me how to solve this ?


I got it! its done by Sonar Hudson Plugin! its always looking for Maven Pom.xml!


The build failure is being thrown because Maven cannot file a POM file....... Why are you running Maven, when you are trying to use the ANT Sonar task?

The new functionality (introduced by Sonar 2.6) enables you to run Sonar analysis from ANT as follows:

$ ant sonar

This of course assumes that you have added a new target to your build.xml called "sonar". For examples of this I recommend the Sonar ANT task documentation:

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜