maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <joerg.schai...@scalaris.com>
Subject Re: writing a parent pom that does not execute its plugins
Date Tue, 18 Oct 2011 13:18:11 GMT
Hi Anders,

Anders Hammar wrote:

> Today, activating a profile defined in a parent from the child is not
> possible.

this is not entirely true:

============= %< ================
$ find .
.
./child1
./child1/pom.xml
./child2
./child2/pom.xml
./child2/v.xml
./pom.xml
============= %< ================

Parent:

============= %< ================
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <artifactId>parent</artifactId>
  <packaging>pom</packaging>
  <version>1-SNAPSHOT</version>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-verifier-plugin</artifactId>
          <version>1.0</version>
          <executions>
            <execution>
              <id>verification</id>
              <phase>verify</phase>
              <goals>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <verificationFile>${basedir}/v.xml</verificationFile>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>auto-verification</id>
      <activation>
        <file>
          <exists>v.xml</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-verifier-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <modules>
    <module>child1</module>
    <module>child2</module>
  </modules>
</project>
============= %< ================

Child1:

============= %< ================
<project>
  <parent>
    <groupId>test</groupId>
    <artifactId>parent</artifactId>
    <version>1-SNAPSHOT</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <artifactId>child2</artifactId>
  <packaging>pom</packaging>
</project>
============= %< ================

Child2 the same, except artifactId. Verification file "child2/v.xml":

============= %< ================
<verifications>
  <files>
    <file>
      <location>pom.xml</location>
      <contains>child2</contains>
    </file>
  </files>
</verifications>
============= %< ================

Works with M3. Works with M2 locally, but not in the reactor.

:)

- Jörg



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


Mime
View raw message