Quantcast

How do I force Sonar to run a Maven goal before Maven-Sonar plugin runs?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How do I force Sonar to run a Maven goal before Maven-Sonar plugin runs?

laredotornado2
Hi,

I have Sonar 3.2.1 installed on CentOS.  I'm using the Sonar plugin for Jenkins (1.478) and have a Maven (3.0.4) job set up.  I have a multi-module project with a WAR component and an EAR component.  The WAR component contains all my tests.  In my Jenkins setup, I run the Maven goals

clean package

All my tests are executed successfully during the Maven phase.  However, when the Maven-sonar plugin runs, many of the tests fail because a properties file cannot be found on the classpath.  If I run the post-build step

mvn clean compile

prior to Sonar, running, Sonar runs successfully (all the tests pass).  Is there a Sonar setting I can set to force it to run the "compile" goal just before it executes?  I would like to set a global setting as opposed to adding the above to every Jenkins job.

Thanks, - Dave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How do I force Sonar to run a Maven goal before Maven-Sonar plugin runs?

Freddy Mallet
Hi Dave, 

You can give a try with the sonar.phase property :

mvn sonar:sonar -Dsonar.phase=compile

Kind regards,
Freddy
-----
Sonar for Continuous Inspection



On Thu, Oct 11, 2012 at 8:43 PM, laredotornado2 <[hidden email]> wrote:
Hi,

I have Sonar 3.2.1 installed on CentOS.  I'm using the Sonar plugin for
Jenkins (1.478) and have a Maven (3.0.4) job set up.  I have a multi-module
project with a WAR component and an EAR component.  The WAR component
contains all my tests.  In my Jenkins setup, I run the Maven goals

clean package

All my tests are executed successfully during the Maven phase.  However,
when the Maven-sonar plugin runs, many of the tests fail because a
properties file cannot be found on the classpath.  If I run the post-build
step

mvn clean compile

prior to Sonar, running, Sonar runs successfully (all the tests pass).  Is
there a Sonar setting I can set to force it to run the "compile" goal just
before it executes?  I would like to set a global setting as opposed to
adding the above to every Jenkins job.

Thanks, - Dave



--
View this message in context: http://sonar.15.n6.nabble.com/How-do-I-force-Sonar-to-run-a-Maven-goal-before-Maven-Sonar-plugin-runs-tp5003967.html
Sent from the Sonar user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Loading...