Eclipse 中不考虑 Maven 配置文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19140645/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven profiles are not considered in Eclipse
提问by du-it
I have three profiles defined in my pom.xml:
我在 pom.xml 中定义了三个配置文件:
<profiles>
<profile>
<id>ABC</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<url.base>http://server1.de</url.base>
<url.searchevse>/search</url.searchevse>
<url.reservation>/reservation</url.reservation>
<url.cancelation>/reservation/cancel</url.cancelation>
<xxx.devmode>false</xxx.devmode>
</properties>
</profile>
<profile>
<id>XYZ</id>
<properties>
<url.base>http://server2.de</url.base>
<url.searchevse>/cns/search</url.searchevse>
<url.reservation>/cns/reservation</url.reservation>
<url.cancelation>/cns/cancel_reservation</url.cancelation>
<xxx.devmode>false</xxx.devmode>
</properties>
</profile>
<profile>
<id>DEVELOPMENT</id>
<properties>
<url.base>http://localhost/noservices</url.base>
<url.searchevse>/no/search</url.searchevse>
<url.reservation>/no/reservation</url.reservation>
<url.cancelation>/no/cancel_reservation</url.cancelation>
<xxx.devmode>true</xxx.devmode>
</properties>
</profile>
</profiles>
In Eclipse I have a Run Configuration
在 Eclipse 中,我有一个运行配置
clean install XYZ
干净安装 XYZ
and I tried both using -PXYZ (and -P XYZ) in the Goalsfield as well as
我尝试在目标字段中使用 -PXYZ(和 -P XYZ)以及
clean install
干净安装
in the Goalsfield and XYZ in the Profilesfield.
在“目标”字段和“配置文件”字段中的XYZ 。
The problem:
问题:
The defined profile is never used.
从不使用定义的配置文件。
Inserting the active profile under Properties-->Maven-->Active Maven Profiles doesn't work (or do I have to use a special syntax, e.g. no spaces after a comma or so).
在 Properties-->Maven-->Active Maven Profiles 下插入活动配置文件不起作用(或者我是否必须使用特殊语法,例如逗号后没有空格)。
回答by Abdullah Khan
Go to
去
Properties-->Maven-->Active Maven Profiles
属性-->Maven-->活动的Maven配置文件
and type in onlythe profile name that you want to run.
并仅输入您要运行的配置文件名称。
If you want to run your ABC
profile type in ABC
in the Active Maven Profile input box.
如果您想在 Active Maven Profile 输入框中运行您的ABC
配置文件类型ABC
。
The description(seperated by commas) given there is a bit confusing.
给出的描述(用逗号分隔)有点混乱。
Once you define your profile name or id in the input box. You can clean and runyour project on your server. By doing so your mentioned active maven profile will be run.
在输入框中定义您的个人资料名称或 ID 后。您可以在服务器上清理和运行您的项目。通过这样做,您提到的活动 Maven 配置文件将运行。
回答by Pippo Basta
verify that plugin execution id are not equal in different profiles
验证插件执行 ID 在不同配置文件中不相等