[ http://jira.codehaus.org/browse/MNG-460?page=comments#action_40865 ]
     
Nicola Ken Barozzi commented on MNG-460:
----------------------------------------

With pompatch.diff one can access the POM by using

 ${[pom_id].[expression]}

where expression is without "project.".


It can be tested like this:

<project name="foo" 
         xmlns:artifact="antlib:org.apache.maven.artifact.ant" 
         default="test-pom">
         
  <target name="test-pom">
    <artifact:pom file="pom.xml" id="pom"/>

    <artifact:setProperty property="my.artifactid" 
                          expression="project.artifactId"
                          pomRefId="pom" />

    <artifact:pom file="pom2.xml" id="my.maven.project"/>

    <artifact:setProperty property="my.artifactid2" 
                          expression="project.artifactId"
                          pomRefId="my.maven.project" />

                      
    <echo>Artifact ID2 = ${my.artifactid2}</echo>
    <echo>Artifact ID2 with PropertyHelper = 
${my.maven.project.artifactId}</echo>

    <echo>Artifact ID = ${my.artifactid}</echo>
    <echo>Artifact ID with PropertyHelper = ${pom.artifactId}</echo>   
  </target>
  
</project>

> Direct access to the POM expressions as ant properties
> ------------------------------------------------------
>
>          Key: MNG-460
>          URL: http://jira.codehaus.org/browse/MNG-460
>      Project: Maven 2
>         Type: New Feature
>   Components: maven-artifact-ant
>     Reporter: Nicola Ken Barozzi
>     Priority: Minor
>      Fix For: 2.0-alpha-3
>  Attachments: POMProperties.java, pompatch.diff
>
>
> ** Disclaimer **
> I have no time now to test it fully ATM, but it should basically work.
> ****************
> This task sets up a PropertyHelper that makes it possible to resolve pom 
> values directly from Ant properties. 
> IOW this:
>     <artifact:setProperty property="my.artifactid" 
>               expression="project.artifactId" 
>               pomRefId="my.maven.project" />
>     
>     then use ${my.artifactid}
> can be replaced by this:
>     use ${pom:my.maven.project/project.artifactId}
>                        - ~ -
> Here is a sample test buildfile:
> <?xml version="1.0" encoding="UTF-8"?>
> <project name="foo" 
>          xmlns:artifact="antlib:org.apache.maven.artifact.ant" 
>          default="test-pom">
>          
>   <taskdef classpath="C:\Documents and 
> Settings\barozzink\Desktop\m2-artifact-nkb\build\classes"
>            name="pomproperties"       
>            classname="org.apache.maven.artifact.ant.POMProperties"/>
>          
>   <target name="test-pom">
>     <artifact:pom file="pom.xml" id="my.maven.project"/>
>     <artifact:setProperty property="my.artifactid" 
> expression="project.artifactId" pomRefId="my.maven.project" />
>     <echo>Artifact ID = ${my.artifactid}</echo>
>     
>     <pomproperties/>
>     <echo>Artifact ID with PropertyHelper = 
> ${pom:my.maven.project/project.artifactId}</echo>
>         
>   </target>
> </project>
>         

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to