我已经声明了一些特定于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>当我通过IntelliJ IDEA 2016开始Junit测试时,我遇到了一些使用"ci“Maven配置文件的问题。
我通过"Maven Projects“面板激活我的配置文件,然后开始测试。问题是"my.properties.file“属性值等于"foo.xml",而不是"bar.xml”。
我对命令行没有问题(我可以使用"-Pci“标志)。我如何告诉IntelliJ使用"ci“配置文件?谢谢。
发布于 2016-05-13 17:38:34
您应该将配置文件添加到Maven setting.xml文件(您应该可以在路径${YOUR_MAVEN_HOME}\apache-maven-3.1.1\conf\setting.xml).中找到它然后,您必须打开intellij,单击View > Tool Windows > Maven Projects。在那里,您应该看到您的配置文件(ci和release)并选择正确的配置文件。
希望这能对你有所帮助。
https://stackoverflow.com/questions/37205962
复制相似问题