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>
부모님의 프로필에는 다음과 같은 프로필이 있습니다. 그러나, 나는 누군가가 그 부모 중 한 명과는 반대로 부모 퐁에 빌드를하고있는 경우에만이 프로파일을 활성화하기를 원합니다. 다른 사람이 자식 프로젝트 빌드를 수행하는 경우 활성화되지 않도록 내가 어떻게 아래 조정할 수 있는지 아는 사람 있습니까?
<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' 프로젝트에도 항상 디렉토리 (및/또는 파일)를 추가 할 수 있습니다. –