Maven properties passed to external ant build file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Maven properties passed to external ant build file

Justin Georgeson-2
I'm using maven-antrun-plugin to execute targets in an external Ant build file, and having an issue with inherited properties.

      <configuration>
          <skip>${skipIvyPublish}</skip>
          <target name="ivy.publish">
              <echo message="resolver: ${ivy.publish.resolver}"/>
              <property name="ivy.publish.resolver" value="${ivy.publish.resolver}"/>
              <echo message="resolver: ${ivy.publish.resolver}"/>
              <ant antfile="${ivy.dependencies.dir}/ivy-build.xml"
                  target="ivy.publish"
                  inheritAll="true"
                  inheritRefs="true"/>
          </target>
      </configuration>

As you might guess from the above, I have a property in my pom.xml named ivy.publish.resolver. The two echo lines here show the correct value (either the default from my pom.xml or what I supply to Maven with -Divy.publish.resolver). But within the ivy-build.xml the very first task executed (the init: target in the output below) is the same echo statement, and inevitably the property value is always the default from pom.xml, ignoring what I've set with -D command-line argument.

    [INFO] --- maven-antrun-plugin:1.8:run (ivy-publish) @ maven-ivy-example ---
    [INFO] Executing tasks

    ivy.publish:
         [echo] resolver: fred
         [echo] resolver: fred

    init:
         [echo] resolver: published.local

Any suggestions?

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient.  Any review, use, distribution, or disclosure by others is strictly prohibited.  If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Maven properties passed to external ant build file

Justin Georgeson-2
Looks like if I use nested <property> elements inside the <ant> call it's working. Which is contrary to the maven-antrun-plugin 'Using Maven properties' section at http://maven.apache.org/plugins/maven-antrun-plugin/usage.html. Will try to reduce and example project and file a bug report.

> -----Original Message-----
> From: Justin Georgeson [mailto:[hidden email]]
> Sent: Thursday, August 17, 2017 5:31 PM
> To: Maven Users List ([hidden email]) <[hidden email]>
> Subject: [EXTERNAL] Maven properties passed to external ant build file
>
> External Sender: Use caution with links/attachments.
>
>
>
> I'm using maven-antrun-plugin to execute targets in an external Ant build file,
> and having an issue with inherited properties.
>
>       <configuration>
>           <skip>${skipIvyPublish}</skip>
>           <target name="ivy.publish">
>               <echo message="resolver:
> $https://urldefense.proofpoint.com/v2/url?u=http-3A__-
> 257Bivy.publish.re&d=DwIFAg&c=PskvixtEUDK7wuWU-
> tIg6oKuGYBRbrMXk2FZvF0UfTo&r=IaG729QyGh1osYCbh8OX9axItHyepxef_hVPx
> 52Ly1s&m=jU_eveXMV4xr4ZGmOAYbmZOCgFUHd7iG3lp8h1UpgFM&s=qcSKdeR
> 57hGmNWmb6d94uy2ZGp25vlzkIPW0iNOqLec&e= solver}"/>
>               <property name="ivy.publish.resolver"
> value="$https://urldefense.proofpoint.com/v2/url?u=http-3A__-
> 257Bivy.publish.re&d=DwIFAg&c=PskvixtEUDK7wuWU-
> tIg6oKuGYBRbrMXk2FZvF0UfTo&r=IaG729QyGh1osYCbh8OX9axItHyepxef_hVPx
> 52Ly1s&m=jU_eveXMV4xr4ZGmOAYbmZOCgFUHd7iG3lp8h1UpgFM&s=qcSKdeR
> 57hGmNWmb6d94uy2ZGp25vlzkIPW0iNOqLec&e= solver}"/>
>               <echo message="resolver:
> $https://urldefense.proofpoint.com/v2/url?u=http-3A__-
> 257Bivy.publish.re&d=DwIFAg&c=PskvixtEUDK7wuWU-
> tIg6oKuGYBRbrMXk2FZvF0UfTo&r=IaG729QyGh1osYCbh8OX9axItHyepxef_hVPx
> 52Ly1s&m=jU_eveXMV4xr4ZGmOAYbmZOCgFUHd7iG3lp8h1UpgFM&s=qcSKdeR
> 57hGmNWmb6d94uy2ZGp25vlzkIPW0iNOqLec&e= solver}"/>
>               <ant antfile="$https://urldefense.proofpoint.com/v2/url?u=http-3A__-
> 257Bivy.de&d=DwIFAg&c=PskvixtEUDK7wuWU-
> tIg6oKuGYBRbrMXk2FZvF0UfTo&r=IaG729QyGh1osYCbh8OX9axItHyepxef_hVPx
> 52Ly1s&m=jU_eveXMV4xr4ZGmOAYbmZOCgFUHd7iG3lp8h1UpgFM&s=j3u9bKQ
> hroNEpQCKrkkRTG5sUpsX2RER9LLvM-V1yiQ&e= pendencies.dir}/ivy-build.xml"
>                   target="ivy.publish"
>                   inheritAll="true"
>                   inheritRefs="true"/>
>           </target>
>       </configuration>
>
> As you might guess from the above, I have a property in my pom.xml named
> ivy.publish.resolver. The two echo lines here show the correct value (either the
> default from my pom.xml or what I supply to Maven with -Divy.publish.resolver).
> But within the ivy-build.xml the very first task executed (the init: target in the
> output below) is the same echo statement, and inevitably the property value is
> always the default from pom.xml, ignoring what I've set with -D command-line
> argument.
>
>     [INFO] --- maven-antrun-plugin:1.8:run (ivy-publish) @ maven-ivy-example ---
>     [INFO] Executing tasks
>
>     ivy.publish:
>          [echo] resolver: fred
>          [echo] resolver: fred
>
>     init:
>          [echo] resolver: published.local
>
> Any suggestions?
>
> ----------------------------------------------------------------------
> This e-mail, including any attached files, may contain confidential and privileged
> information for the sole use of the intended recipient.  Any review, use,
> distribution, or disclosure by others is strictly prohibited.  If you are not the
> intended recipient (or authorized to receive information for the intended
> recipient), please contact the sender by reply e-mail and delete all copies of this
> message.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]