maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Boué (JIRA) <j...@apache.org>
Subject [jira] [Commented] (MANTRUN-172) Properties passed to Maven as -D don't get passed to <ant> invocations when a profile sets the same property
Date Wed, 31 May 2017 21:56:04 GMT

    [ https://issues.apache.org/jira/browse/MANTRUN-172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16032054#comment-16032054
] 

Guillaume Boué commented on MANTRUN-172:
----------------------------------------

This is actually unrelated to the Ant task not propagating properties to subinvocation (it
does so correctly); it is the same root issue as MANTRUN-178.

When the effective model is built with {{-Dmy.test.property="from commandline" -Ptest-profile}}:
1. the profile are injected; at that time {{my.test.property=from profile}} and {{ptest=$&#123;my.test.property&#125;}},
2. the model is interpolated; at that time {{my.test.property=from profile}}, {{ptest=from
commandline}} and the two expressions located in the {{<target>>}} antrun configuration
in the POM are also replaced to {{from commandline}}. So far so good, and you'll notice that
the values echoed from the POM are {{from commandline}}, because they were already replaced
during model interpolation.

As shown in MANTRUN-178, the value of a property declared in the POM was not correctly overriden
from a user property during Ant invocation; it only copied the value from the POM properties
section, which are still {{my.test.property=from profile}}, {{ptest=from commandline}}. So
this is what gets passed to Ant, and to the subproject, which prints it.

The fix introduced for MANTRUN-178, consequently, also fixes this, since it makes sure the
values passed to Ant can be overriden from the command line.

> Properties passed to Maven as -D don't get passed to <ant> invocations when a profile
sets the same property
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: MANTRUN-172
>                 URL: https://issues.apache.org/jira/browse/MANTRUN-172
>             Project: Maven Antrun Plugin
>          Issue Type: Bug
>    Affects Versions: 1.7
>            Reporter: Derek Lewis
>         Attachments: maven-antrun-plugin-bug.zip
>
>
> When I invoke Maven as follows:
> mvn package -Dmy.test.property="from commandline" -Ptest-profile
> Setting my.test.property on the command line, I expect to see the following output from
the testcase:
> [echo] pom.xml: ptest = from commandline
> [echo] pom.xml: my.test.property = from commandline
> [echo] build.xml: ptest = from commandline
> [echo] build.xml: my.test.property = from commandline
> But instead I see:
> [echo] pom.xml: ptest = from commandline
> [echo] pom.xml: my.test.property = from commandline
> [echo] build.xml: ptest = from commandline
> [echo] build.xml: my.test.property = from profile
> It looks like the <ant> task is causing properties set on the command line to not
be inherited.
> When run without -Ptest-profile, the expected output is seen.  The comments on MANTRUN-121
would seem to imply that properties set on the commandline should always be passed to sub
<ant> builds, regardless of the value of the inheritAll property.
> I've tested with a profile in the pom as well as in settings.xml, and the same behavior
is observed regardless of where the profile is, so long as it is activated.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message