如何将$JBOSS_HOME环境变量传递到Maven脚本中?
我正在使用Mac10.9.5和maven 3.2.3。我在我的如何将$JBOSS_HOME环境变量传递到Maven脚本中?,maven,environment-variables,maven-3,Maven,Environment Variables,Maven 3,我正在使用Mac10.9.5和maven 3.2.3。我在我的~/.profile文件中定义了一个环境变量,$JBOSS\u HOME,可以通过shell访问该变量。有没有一种方法,使用MAVEN_OPTS或类似的方法,我可以在MAVEN-antrun插件中引用这个值?以下是我的插件的相关部分 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven
~/.profile
文件中定义了一个环境变量,$JBOSS\u HOME
,可以通过shell访问该变量。有没有一种方法,使用MAVEN_OPTS
或类似的方法,我可以在MAVEN-antrun插件中引用这个值?以下是我的插件的相关部分
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>create-dodeploy-file</id>
<phase>package</phase>
<configuration>
<target>
<echo
file="$JBOSS_HOME/standalone/deployments/${project.artifactId}.war.dodeploy"
append="false" message="" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
org.apache.maven.plugins
maven antrun插件
1.7
创建dodeploy文件
包裹
跑
我更愿意这样做,即在每次调用时不必向Maven传递命令行(例如,
-DJBOSS\u HOME=$JBOSS\u HOME
。如果有某种系统方法可以告诉Maven这个环境变量,那将是最好的。您可以使用env.
在pom.xml
中引用环境变量:
<properties>
<JBOSS_HOME>${env.JBOSS_HOME}</JBOSS_HOME>
</properties>
<!-- plugin declaration, snipped -->
<echo
file="${JBOSS_HOME}/standalone/deployments/${project.artifactId}.war.dodeploy"
append="false" message="" />
${env.JBOSS_HOME}