我正在使用Maven 3.0.3。我有一个项目,从父母继承...Maven:只想运行配置文件,如果在父pom上构建的话
<modelVersion>4.0.0</modelVersion>
<groupId>com.myco.util.ant</groupId>
<artifactId>selenium-framework</artifactId>
<packaging>jar</packaging>
<name>Myco Selenium Utils</name>
<parent>
<groupId>com.nna</groupId>
<artifactId>parent</artifactId>
<version>1.2-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
在我父母pom我有以下配置文件。但是,如果有人正在对父项目进行构建,而不是其中的一个子项目,我只希望此配置文件保持活跃状态。有谁知道我可以如何调整下面的内容,以便在有人正在构建子项目时不会激活它?
<profile>
<id>deploy-snapshot</id>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>deploy</phase>
<configuration>
<target>
<condition property="is-release">
<not>
<contains string="${project.version}" substring="SNAPSHOT" />
</not>
</condition>
<fail if="is-release" message="You can only deploy snapshot versions of this project." />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
谢谢 - 戴夫
感谢有关基于文件存在的配置文件激活的想法,但我的父项目只有一个pom.xml文件和目标目录,不足以(仅基于这些文件)将其与子项目区分开来。任何其他想法? - – Dave
@Dave。你总是可以将目录(和/或文件)添加到“pom”项目中。 –