You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by jabba <ka...@soebes.de> on 2009/12/14 17:36:18 UTC

Maven Exec - Inheritance - Multi Module Build

Hi,

i'm testing a setup with Maven and a combination of Java/Non Java Projects
(using RPM plugin etc.)...

I'm using a parent to bind some calls to exec plugin to particular phases:

<build>
   <plugins>
      <plugin>
               <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.1.1</version>
                <executions>
                    <execution>
                        <id>initialize</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>cmake</executable>
                            <arguments>
                                <argument>....</argument>
                                <argument>.</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.1.1</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>make</executable>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
   </plugins>
</build>
...
Using the rpm-plugin in modules is working like a charm...so far so good....

but now i reached a little problem, cause i have a piling project which does
not need any calls to the above exec parts...but based on my configuration
they are of course called as defined....

Is there a way to prevent calling the exec's in a sub-module which inherits
the parent pom information....

Kind regards
Karl Heinz Marbaise
-- 
View this message in context: http://old.nabble.com/Maven-Exec---Inheritance---Multi-Module-Build-tp26779913p26779913.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Maven Exec - Inheritance - Multi Module Build

Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi Anders,


Anders Hammar wrote:
> 
> I didn't say it would. :-)No you didn't ;-)


Anders Hammar wrote:
> 
> There has been several similar questions like this on this list before.
> There is no generic way to exclude a bound plugin in a single sub-project.
> Either all sub-projects inherit the plugin binding or none.
> Some plugins provide a configuration option to skip execution (look at
> surefire which has a skipTests option) however. Technically, this still
> executes the bound plugin but the plugin doesn't do anything (all
> dependeing
> on the plugin's logic for that option). As an end user the difference
> shouldn't really matter, but technically there is a bug difference.
> Also, there is an option to say that a plugin binding shouldn't be
> inherited
> by any sub-project. You do that by declaring:
> <inherited>false</inherited>
> You can find examples of that here:
> http://maven.apache.org/guides/introduction/introduction-to-the-pom.html
> 
> In your case, I would look at this option for the exec plugin:
> http://mojo.codehaus.org/exec-maven-plugin/exec-mojo.html#skip
> The tip with the skip did the trick....

Now my derived project looks like the following:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.1.1</version>
                <executions>
                    <execution>
                        <id>initialize</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>compile</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

May be it's not the best solution but it works...

Many thanks for your help.

Kind regards
Karl Heinz Marbaise
-- 
View this message in context: http://old.nabble.com/Maven-Exec---Inheritance---Multi-Module-Build-tp26779913p26791229.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Maven Exec - Inheritance - Multi Module Build

Posted by Anders Hammar <an...@hammar.net>.
I didn't say it would. :-)

There has been several similar questions like this on this list before.
There is no generic way to exclude a bound plugin in a single sub-project.
Either all sub-projects inherit the plugin binding or none.
Some plugins provide a configuration option to skip execution (look at
surefire which has a skipTests option) however. Technically, this still
executes the bound plugin but the plugin doesn't do anything (all dependeing
on the plugin's logic for that option). As an end user the difference
shouldn't really matter, but technically there is a bug difference.
Also, there is an option to say that a plugin binding shouldn't be inherited
by any sub-project. You do that by declaring:
<inherited>false</inherited>
You can find examples of that here:
http://maven.apache.org/guides/introduction/introduction-to-the-pom.html

In your case, I would look at this option for the exec plugin:
http://mojo.codehaus.org/exec-maven-plugin/exec-mojo.html#skip

/Anders

On Tue, Dec 15, 2009 at 08:47, Karl Heinz Marbaise <ka...@soebes.de> wrote:

>
> Hi Anders,
> what you mentioned is correct, but this does not solve my problem...
>
> BTW: The usage works for MVN 2.2.1 and MVN 3.0 - Alpha 5...but i've checked
> the docs and you're right...
>
>
> Anders Hammar wrote:
> >
> > I just wanted to mention that defining two plugin sections of the same
> > plugin (exec-maven-plugin in your case) is incorrect. I believe there is
> a
> > bug in som Maven versions that allow that, but it's not te corredt way of
> > doing things. Instead, you should specify two execution sections in the
> > same
> > plugin section.
> >
> >
>
> Kind regards
> Karl Heinz Marbaise
> --
> View this message in context:
> http://old.nabble.com/Maven-Exec---Inheritance---Multi-Module-Build-tp26779913p26790912.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Maven Exec - Inheritance - Multi Module Build

Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi Anders,
what you mentioned is correct, but this does not solve my problem...

BTW: The usage works for MVN 2.2.1 and MVN 3.0 - Alpha 5...but i've checked
the docs and you're right...


Anders Hammar wrote:
> 
> I just wanted to mention that defining two plugin sections of the same
> plugin (exec-maven-plugin in your case) is incorrect. I believe there is a
> bug in som Maven versions that allow that, but it's not te corredt way of
> doing things. Instead, you should specify two execution sections in the
> same
> plugin section.
> 
> 

Kind regards
Karl Heinz Marbaise
-- 
View this message in context: http://old.nabble.com/Maven-Exec---Inheritance---Multi-Module-Build-tp26779913p26790912.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Maven Exec - Inheritance - Multi Module Build

Posted by Anders Hammar <an...@hammar.net>.
I just wanted to mention that defining two plugin sections of the same
plugin (exec-maven-plugin in your case) is incorrect. I believe there is a
bug in som Maven versions that allow that, but it's not te corredt way of
doing things. Instead, you should specify two execution sections in the same
plugin section.

/Anders

On Mon, Dec 14, 2009 at 17:36, jabba <ka...@soebes.de> wrote:

>
> Hi,
>
> i'm testing a setup with Maven and a combination of Java/Non Java Projects
> (using RPM plugin etc.)...
>
> I'm using a parent to bind some calls to exec plugin to particular phases:
>
> <build>
>   <plugins>
>      <plugin>
>               <groupId>org.codehaus.mojo</groupId>
>                <artifactId>exec-maven-plugin</artifactId>
>                <version>1.1.1</version>
>                <executions>
>                    <execution>
>                        <id>initialize</id>
>                        <phase>initialize</phase>
>                        <goals>
>                            <goal>exec</goal>
>                        </goals>
>                        <configuration>
>                            <executable>cmake</executable>
>                            <arguments>
>                                <argument>....</argument>
>                                <argument>.</argument>
>                            </arguments>
>                        </configuration>
>                    </execution>
>                </executions>
>            </plugin>
>
>            <plugin>
>                <groupId>org.codehaus.mojo</groupId>
>                <artifactId>exec-maven-plugin</artifactId>
>                <version>1.1.1</version>
>                <executions>
>                    <execution>
>                        <id>compile</id>
>                        <phase>compile</phase>
>                        <goals>
>                            <goal>exec</goal>
>                        </goals>
>                        <configuration>
>                            <executable>make</executable>
>                        </configuration>
>                    </execution>
>                </executions>
>            </plugin>
>   </plugins>
> </build>
> ...
> Using the rpm-plugin in modules is working like a charm...so far so
> good....
>
> but now i reached a little problem, cause i have a piling project which
> does
> not need any calls to the above exec parts...but based on my configuration
> they are of course called as defined....
>
> Is there a way to prevent calling the exec's in a sub-module which inherits
> the parent pom information....
>
> Kind regards
> Karl Heinz Marbaise
> --
> View this message in context:
> http://old.nabble.com/Maven-Exec---Inheritance---Multi-Module-Build-tp26779913p26779913.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>