On Jan 13, 2011, at 5:10 PM, Dean Schulze wrote:

> 
>                I need to modify the maven build for a large project 
> to skip certain steps during typical development builds (i.e. don't 
> build the *-source.jar files).  I've searched for "conditional 
> execution" for maven, but haven't found anything.
> 

Building the source JARs is not something that happens by default, typically 
this happens in a release profile that is triggered by the release plugin. 
Conditional logic is generally frowned upon in Maven whereas layering the 
functionality you need in profiles that can be activated conditionally is the 
way to go.

> A dev profile sounds like the intuitive way to do this - but I don't 
> know how intuitive maven is.  The docs for profiles show how to set 
> different properties (i.e. database connection parameters) for different
> profiles.  I suppose I could set a property and then test if that 
> property is set in the maven-source-plugin - executions - execution tag.

You can specify plugins in profiles too, which is typically where the 
maven-source-plugin is configured.

> 
> Is this the right way to do conditional execution in maven?
> 

Profiles that are activated explicitly, with a property, the presence of a 
specific file.

> What's the "right" way to do this in maven?
> 

If the source JARs are being created then you need to find out which POM it's 
in and if it's in a profile that is activated by default, then activating 
another profile will deactivate that profile which should knock out the source 
JAR generation. If it's not in a profile then that POM will need to be changed 
so that it is in a profile so that behaviour can be conditionally activated.

> Thanks.
> 
> 
> 
> 

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

A party which is not afraid of letting culture,
business, and welfare go to ruin completely can
be omnipotent for a while.

  -- Jakob Burckhardt



Reply via email to