简体   繁体   English

Idea 14 - Maven 3 - 传递参数

[英]Idea 14 - Maven 3 - pass parameters

I am looking for most efficient way to pass parameters to maven through idea 14 (I have just started working with idea).我正在寻找通过idea 14(我刚刚开始使用idea)将参数传递给maven的最有效方法。

When I want to compile and deploy my application through maven itself, I just run this command mvn clean package tomcat7:redeploy -P localhost -Daugage_env=local .当我想通过 maven 本身编译和部署我的应用程序时,我只需运行这个命令mvn clean package tomcat7:redeploy -P localhost -Daugage_env=local

I dont know, how to pass this parameter -Daugage_env=local as default (or how to integrate it with localhost profile, which would be even better).我不知道,如何将这个参数-Daugage_env=local作为默认值传递(或者如何将它与 localhost 配置文件集成,这会更好)。

I did try maven-projects->myproject->lifecycle-> right click on compile and create custom compile where I changed the Command line text to compile -Daugage_env=local , but it does not work.我确实尝试过maven-projects->myproject->lifecycle->右键单击 compile 并创建自定义编译,我将Command line文本更改为compile -Daugage_env=local ,但它不起作用。

You can define profile specific properties directly in pom.xml like so:您可以直接在 pom.xml 中定义特定于配置文件的属性,如下所示:

<profile>
    <id>localhost</id>
    <properties>
        <augage_env>local</augage_env>
    </properti‌​es>
</profile>

More information can be found in Maven documentation for build profiles .更多信息可以在构建配置文件的 Maven 文档中找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM