Jon*_*age 14 java junit intellij-idea maven
我已经声明了一些特定于Maven配置文件的属性.我的pom.xml的一部分:
<profiles>
<profile>
<id>release</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<my.properties.file>foo.xml</my.properties.file>
</properties>
</profile>
<profile>
<id>ci</id>
<properties>
<my.properties.file>bar.xml</my.properties.file>
</properties>
</profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)
当我通过IntelliJ IDEA 2016启动Junit测试时,我遇到一些使用"ci"Maven配置文件的问题.
我通过"Maven Projects"面板激活我的配置文件,然后我开始测试.问题是"my.properties.file"属性值等于"foo.xml",而不是"bar.xml".
我没有命令行的问题(我可以使用"-Pci"标志).如何告诉IntelliJ使用"ci"配置文件?谢谢.
您应该将配置文件添加到 Maven setting.xml 文件(您应该在路径 ${YOUR_MAVEN_HOME}\apache-maven-3.1.1\conf\setting.xml 中找到它)。然后,您必须打开intellij,单击“View”>“Tool Windows”>“Maven Projects”。在那里,您应该看到您的配置文件(ci 和release)并选择正确的配置文件。
希望这可以帮到你。