如果可以啓動兩個Maven構建了一個又一個,然後嘗試類似的東西:
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<excludes>
<exclude>**/test/**${dontUse}.properties</exclude>
</excludes>
<includes>
<include>**/test/**${use}.properties</include>
</includes>
</configuration>
</execution>
並通過dontUse並將其作爲參數使用行家。或者您可以定義兩個配置文件 - 一個包含第一個配置文件,一個包含其他屬性文件 - 然後使用這兩個配置文件啓動構建。 編輯:加載屬性文件與一個單一的類,你檢查文件是否存在。無論是第一個還是第二個。 類似的東西:
public Properties load() {
Properties prop = new Properties();
try {
InputStream in;
in = getClass().getResourceAsStream("first.properties");
if (in == null)
in = getClass().getResourceAsStream("second.properties");
prop.load(in);
in.close();
return prop;
} catch (Exception e) {
e.printStackTrace();
}
return prop;
}
故障保護比神火在集成測試階段使用更好 – artbristol
YES,完全同意 –
感謝揚的回答,它的工作的。但是我怎麼能只做一次maven構建呢。 Surefire可以嗎? –