Вопрос по maven, java – Как ссылаться на переменную среды в POM.xml?

132

Error: User Rate Limit ExceededenvError: User Rate Limit Exceededpom.xmlError: User Rate Limit Exceeded

Error: User Rate Limit Exceeded Stephen C
Error: User Rate Limit Exceeded Andrew White
Error: User Rate Limit Exceeded user1016403
Error: User Rate Limit Exceeded weberjn
Error: User Rate Limit Exceeded Seshagiri

Ваш Ответ

5   ответов
10

<properties>
    <my.variable>${env.MY_VARIABLE}</my.variable>
</properties>
Error: User Rate Limit Exceeded
3

${env.foo}${env.FOO}

Set the variable in the shell script. If you're launching Maven in a sub-script, make sure the variable is getting set, e.g. using source ./maven_script.sh to call it from the parent script.

In shared-pom, create a command-line param that grabs the environment variable:

<plugin>
  ...
  <executions>
    <executions>
    ...
      <execution>
      ...
        <configuration>
          <param>${foo}</param> <!-- Note this is *not* ${env.foo} -->
        </configuration>

In com.google.code.maven-replacer-plugin, make the replacement value ${foo}.

In my shell script that calls maven, add this to the command: -Dfoo=$foo

22

<properties>
    ...
    <!-- Default value for my.variable can be defined here -->
    <my.variable>foo</my.variable>
    ...
</properties>
...
<!-- Use my.variable -->
... ${my.variable} ...

mvn clean package -Dmy.variable=$MY_VARIABLE
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
173

...

${env.VARIABLE_NAME}

pom.xml

Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
Error: User Rate Limit ExceededWindowsError: User Rate Limit ExceededMacOS/Linux/UnixError: User Rate Limit ExceededTerminalError: User Rate Limit Exceeded
Error: User Rate Limit Exceeded
19

environment variablecomposed only by UPPER CASE LETTERS

DUMMY DUMMY_ONE JBOSS_SERVER_PATH

(NOTE

Error: User Rate Limit Exceeded
Error: User Rate Limit Exceeded

Похожие вопросы