maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darryl L. Miles (JIRA)" <j...@codehaus.org>
Subject [jira] (MANTRUN-177) Ant properties not passed to maven 3.0.4
Date Thu, 03 Jan 2013 03:53:13 GMT

    [ https://jira.codehaus.org/browse/MANTRUN-177?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=316523#comment-316523
] 

Darryl L. Miles edited comment on MANTRUN-177 at 1/2/13 9:52 PM:
-----------------------------------------------------------------

`# Unix
MY_VARIABLE_ON_THIS_HOST=prd
export MY_VARIABLE_ON_THIS_HOST

`# Windows
set MY_VARIABLE_ON_THIS_HOST=prd

<project>
 <properties>
  <filters.file>${env.MY_VARIABLE_ON_THIS_HOST}</filters.file>
 </properties>
</project>

You can use the 'maven-enforcer-plugin' [ https://maven.apache.org/enforcer/maven-enforcer-plugin/usage.html
] to fail any Maven usage that does not setup the environment variable first.  There is <requireEnvironmentVariable>
 but I'd use <requireProperty>  for ${filters.file} being a non-empty value, or better
any one of the valid values <regex>^(pc|dev|test|prd)$</regex> info on this at
https://maven.apache.org/enforcer/enforcer-rules/requireProperty.html

You can configure the environment variable in a place on each system that is globally picked
up by all logged in users /etc/profile on Unix or System Properties on Windows.


Now you no longer need to tie your config to a 'hostname' which is an unrelated information,
you also do not need an 'ANT' dependency if this is the only use.


                
      was (Author: dlmiles):
     # Unix
MY_VARIABLE_ON_THIS_HOST=prd
export MY_VARIABLE_ON_THIS_HOST

 # Windows
set MY_VARIABLE_ON_THIS_HOST=prd

<project>
 <properties>
  <filters.file>${env.MY_VARIABLE_ON_THIS_HOST}</filters.file>
 </properties>
</project>

You can use the 'maven-enforcer-plugin' [ https://maven.apache.org/enforcer/maven-enforcer-plugin/usage.html
] to fail any Maven usage that does not setup the environment variable first.  There is <requireEnvironmentVariable>
 but I'd use <requireProperty>  for ${filters.file} being a non-empty value, or better
any one of the valid values <regex>^(pc|dev|test|prd)$</regex> info on this at
https://maven.apache.org/enforcer/enforcer-rules/requireProperty.html

You can configure the environment variable in a place on each system that is globally picked
up by all logged in users /etc/profile on Unix or System Properties on Windows.


Now you no longer need to tie your config to a 'hostname' which is an unrelated information,
you also do not need an 'ANT' dependency if this is the only use.


                  
> Ant properties not passed to maven 3.0.4
> ----------------------------------------
>
>                 Key: MANTRUN-177
>                 URL: https://jira.codehaus.org/browse/MANTRUN-177
>             Project: Maven 2.x Antrun Plugin
>          Issue Type: Bug
>    Affects Versions: 1.7
>         Environment: Apache Maven 3.0.4 (r1232337; 2012-01-17 01:44:56-0700)
> Java version: 1.6.0_34, vendor: Sun Microsystems Inc.
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
>            Reporter: Paul Gazda
>         Attachments: build.log, pom.xml_test
>
>
> I have a pom.xml that uses maven-antrun-plugin v 1.7 in phase "validate"
> to detect the run environment, and based on that set the appropriate
> filters file path as property "filters.file". exportAntProperties is set to
> true. The filters.file property is supposed to be used in the filters tag
> like this:
>   <build>
>       <filters>
>         <filter>${filters.file}</filter>
>       </filters>
>  .
>  .
>  .
> This worked when I was using maven 2.2.1, but since I upgraded to maven
> 3.0.4, the value for filters.file is no longer being passed to the <filter>
> tag.
> I have attached a test pom.xml I created to demonstrate the problem. If "mvn install"
is run with maven 2.2.1, the value for ${filters.file} is passed to maven (the install will
fail after this because it is a dummy test, but it is clear that the ${filters.file} value
has been passed correctly). If I run it with maven 3.0.4, the value for ${filters.file} is
not passed to maven. I have attached and the maven build log from the failed 3.0.4 "mvn install".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message