如何在maven项目中设置默认参数?

时间:2014-06-12 08:24:20

标签: maven maven-2 maven-3

要在我的测试阶段禁用缓存,我需要输入命令:

mvn test -Dnet.sf.ehcache.disabled=true

有没有办法将此属性“net.sf.ehcache.disabled”设置为默认值? (哪个menas:每当我指定“mvn test”时,我想将此参数“net.sf.ehcache.disabled”自动设置为true)

1 个答案:

答案 0 :(得分:1)

您可以尝试在pom.xml中配置surefire插件,如下所示:

...
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <systemPropertyVariables>
                    <net.sf.ehcache.disabled>true</net.sf.ehcache.disabled>
                </systemPropertyVariables>
            </configuration>
        </plugin>
    </plugins>
</build>
...