You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Tomasz Majchrowski <us...@majchrowski.de> on 2013/10/04 18:09:22 UTC

define plugin excution in parent => execute goal on child only

Hi All,

I'm working in environment for which we would like to centralize the build
configuration.
We are using already project parent to control centrally several versions
of the plugins.

Now we would like to extend it about controlling invoking of the plugins in
order to
minimize the amount of configuration that gets duplicated in each of the
child projects.

We found two options and considering the option 1 as this one which will
fit our need.
The motivation for invoke removal in parent context is to use this parent
for mentioned
plug-in itself.

Q1: Is there any pitfall related to fact that parent will contain reference
to the
plug-in which will use this parent ?

Q2: Is there any other options to exclude plug-in invoke from parent only ?

Best regards, Tomasz.




1) What we found profile/build together with file/missing is very useful in
this area


    <profiles>
        <profile>
            <id>bar-gen-workflow</id>
            <activation>
                <file>

<missing>${project.basedir}/common.build.primitives.flag</missing>
                </file>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>common.build.foo</groupId>
                        <artifactId>bargen</artifactId>
                        <executions>
                            <execution>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>touch</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

2) The another option will be to deploy the parent by "external" pom rather
than it's own
so we will avoid any build phase for it.

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-deploy-plugin</artifactId>
        <executions>
            <execution>
                <id>parent4plugins</id>
                      <phase>deploy</phase>
                      <goals>
                          <goal>deploy-file</goal>
                      </goals>
                      <configuration>
                          <repositoryId>${
project.distributionManagement.repository.id}</repositoryId>

<url>${project.distributionManagement.repository.url}</url>
                          <groupId>common.build.foo</groupId>
                          <artifactId>parent4plugins</artifactId>
                          <version>${project.version}</version>
                          <packaging>pom</packaging>

<file>${project.build.directory}/resources/parent4plugins/pom.xml</file>
                          <generatePom>false</generatePom>

-- 
Pozdrawiam/Best regards/Mit freundlichen Grüßen, Tomasz Majchrowski,
Information Technology and Services Consultant and Contractor