You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kreyßel, Conny <Co...@INTER-FORUM.DE> on 2011/08/04 15:47:34 UTC

Execution of plugin in child poms and not in current pom

Hello,

i try to create a "company parent pom" that defines the usage of the enforcer plugin with some handmade enforcer rules. This rules validates the project settings for all our applications we build with maven.

My problem is that the enforcer plugin (and the defined rules) are called in the run of the "company parent pom" build and fail the build because he use the rules that should only be used in application projects. 

Do anyone know how if i can fix this? The enforcer plugin should only called in all projects based on "company parent pom" as parent.

Thanks.

Conny


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Execution of plugin in child poms and not in current pom

Posted by Milos Kleint <mk...@gmail.com>.
you could place the enforcer plugin definition in <pluginManagement>
section of the parent pom and then in each of the child poms you want
to execute the plugin, you would include it in the <plugins> section

Milos

On Thu, Aug 4, 2011 at 3:47 PM, Kreyßel, Conny
<Co...@inter-forum.de> wrote:
> Hello,
>
> i try to create a "company parent pom" that defines the usage of the enforcer plugin with some handmade enforcer rules. This rules validates the project settings for all our applications we build with maven.
>
> My problem is that the enforcer plugin (and the defined rules) are called in the run of the "company parent pom" build and fail the build because he use the rules that should only be used in application projects.
>
> Do anyone know how if i can fix this? The enforcer plugin should only called in all projects based on "company parent pom" as parent.
>
> Thanks.
>
> Conny
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Execution of plugin in child poms and not in current pom

Posted by Marcin Kuthan <ma...@gmail.com>.
Hi Conny

Define enforcer rules in the profile, e.g:

 <profile>
                        <id>enforcer-rules</id>
                        <activation>
                                <!-- To disable profile, define
property -Dacme-corporate-pom.enforcerRulesDisabled=true -->
                                <property>

<name>!acme-corporate-pom.enforcerRulesDisabled</name>
                                </property>
                        </activation>

...
</profile>

When you build corporate pom, disable the profile with:

mvn -Dacme-corporate-pom.enforcerRulesDisabled=true ....

For all other projects the profile is enabled by default.

--
Marcin Kuthan
Maven For Enterprise - http://code.google.com/p/m4enterprise/


On 4 August 2011 15:47, Kreyßel, Conny <Co...@inter-forum.de> wrote:
> Hello,
>
> i try to create a "company parent pom" that defines the usage of the enforcer plugin with some handmade enforcer rules. This rules validates the project settings for all our applications we build with maven.
>
> My problem is that the enforcer plugin (and the defined rules) are called in the run of the "company parent pom" build and fail the build because he use the rules that should only be used in application projects.
>
> Do anyone know how if i can fix this? The enforcer plugin should only called in all projects based on "company parent pom" as parent.
>
> Thanks.
>
> Conny
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Execution of plugin in child poms and not in current pom

Posted by Marc Rohlfs <po...@googlemail.com>.
Hi Conny,

what about this idea:

1. Create a properties file 'something.properties' in Your parent POM 
module directory and set the 'skip' property for the enforcer plugin in 
there:
   enforcer.skip=true

2. Configure the Properties Plugin in the build section of Your parent POM:
   <plugin>
     <groupId>org.codehaus.mojo</groupId>
     <artifactId>properties-maven-plugin</artifactId>
     <version>1.0-alpha-2</version>
     <executions>
       <execution>
         <goals>
           <goal>read-project-properties</goal>
         </goals>
         <!--
           Bind the execution to the validate phase so
           that it is executed BEFORE the enforcer plugin
         -->
         <phase>validate</phase>
         <configuration>
           <!--
             The execution should not fail if
             the properties file cannot be found
           -->
           <quiet>true</quiet>
           <files>
             <file>something.properties</file>
           </files>
         </configuration>
       </execution>
     </executions>
   </plugin>

With this, the execution of the Enforcer plugin should be skipped only 
in modules that contain the 'something.properties' with the property 
'enforcer.skip=true'.

I only tested it briefly, but it seems to work.

Hope that helps

   Marc

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org