Java 如何使用不同的系统属性值执行两个完全相同的maven概要文件?
我在我的Java 如何使用不同的系统属性值执行两个完全相同的maven概要文件?,java,maven,build,maven-2,maven-3,Java,Maven,Build,Maven 2,Maven 3,我在我的pom文件中有下面提到的实现 <profile> <id>test</id> <activation> <activeByDefault>true</activeByDefault> <property> <name>test</name> <
pom
文件中有下面提到的实现
<profile>
<id>test</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>test</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<includes>
<include>set.xml</include>
</includes>
<dir>test/resources/</dir>
<stylesheet>
test/resources/ser.xsl
</stylesheet>
<outputDir>test/resources</outputDir>
</transformationSet>
</transformationSets>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>saxon</artifactId>
<version>8.7</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<inherited>false</inherited>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<systemProperties>
<property>
<name>maven.test.haltafterfailure</name>
<value>false</value>
</property>
<property>
<name>java.io.tmpdir</name>
<value>${basedir}/target/</value>
</property>
<property>
<name>isValid</name>
<value>false</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
但是我不知道如何使用xmlmaven插件在
中设置系统变量和
属性
我需要使用什么插件来达到我的要求
有没有一种方法可以使用系统属性isValid等于
true
和false
并同时使用不同的
值(不同的testng文件)来运行这两个概要文件?如果复制概要文件,则定义相同的插件两次,从而覆盖配置
相反,定义同一插件的两个
。如何在
内部指定
和
。我想他们不允许进入
你试过了吗?我会把它放在
内的
块中。我们可以在
中指定
。但是,当我使用'xmlmaven plugin'时,它不允许我放置
。是的,但在您的解决方案中,情况也是如此。此外,在XMLMaven插件中需要一个系统变量做什么?我需要运行两次测试。在第一次运行时,它应该运行isValid=true
,然后运行isValid=false
。如果我们不能在XMLMaven插件中指定它,我们怎么做呢?
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>.... </configuration>
</execution>
<execution>
<phase>compile</phase>
<goals>
<goal>transform</goal>
</goals>
<configuration>.... </configuration>
</execution>
</executions>