是否可以在 maven3 中设置默认属性。我可以通过以下方式从 bash 中获取 CATALINA_HOME
<properties>
<cargo.tomcat.home>${env.CATALINA_HOME}</cargo.tomcat.home>
</properties>
但是,如果未设置变量并且我运行评估表达式命令,我会得到空对象
!mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=cargo.tomcat.home
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-help-plugin:2.1.1:evaluate (default-cli) @ cargo-selenium-springmvc-webapp ---
[INFO] No artifact parameter specified, using 'com.keybroker.spike:cargo-selenium-springmvc-webapp:war:1.0-SNAPSHOT' as project.
[INFO]
null object or invalid expression
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.721s
[INFO] Finished at: Tue Jul 17 16:51:48 CEST 2012
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------
我有兴趣设置一个默认的 $CATALINA_HOME。我不介意使用另一个插件,但 vanilla maven3 会是最好的。所以我在找什么
if $CATALINA_HOME is set by bash then use it
otherwise if the is a -DcatalinaHome argument passed to maven, then use that
if all else fails, default to XYZ path for $CATALINA_HOME