Maven 2 Maven:如果在父pom上进行构建,则只希望运行概要文件
我使用的是Maven 3.0.3。我有一个从父项继承的项目Maven 2 Maven:如果在父pom上进行构建,则只希望运行概要文件,maven-2,maven,Maven 2,Maven,我使用的是Maven 3.0.3。我有一个从父项继承的项目 <modelVersion>4.0.0</modelVersion> <groupId>com.myco.util.ant</groupId> <artifactId>selenium-framework</artifactId> <packaging>jar</packaging> <name&
<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>
4.0.0
com.myco.util.ant
硒骨架
罐子
真菌硒制剂
com.nna
父母亲
1.2-1
../parent
在我的父母pom中,我有以下个人资料。但是,我只希望当有人在父pom(而不是它的一个子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>
部署快照
maven antrun插件
1.6
部署
跑
真的
谢谢,-Dave您可以尝试通过存在/不存在文件或目录来激活它。你可以找到一个。请注意,“当前工作目录”和“
${project.basedir}
”之间存在差异,如果这对您很重要的话,Maven 2和Maven 3之间的差异也略有不同。我有过类似的情况,我希望在默认情况下在子项目中运行概要文件,但在从顶层构建时不这样做,同时,还可以选择从顶层项目运行它
我将user.dir
属性与Ryan的引用结合使用
在集成项目的pom中:
<profile>
<id>continuous-integration</id>
<!-- Two ways of activating this profile -->
<activation>
<!-- Run the build from the top with param -DfullTest -->
<property>
<name>fullTest</name>
</property>
<!-- Run the build from the integration directory -->
<file>
<missing>${user.dir}/integration</missing>
</file>
</activation>
...
<profile>
连续积分
充分的
${user.dir}/integration
...
如果需要禁用,只需将
更改为,感谢您提出的基于文件存在的概要文件激活的想法,但我的父项目只有一个pom.xml文件和一个目标目录,不足以(仅基于这些文件)将其与子项目区分开来。还有其他想法吗-@戴夫。您始终可以将目录(和/或文件)添加到pom
项目中。