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

Alex Szczuczko commented on MANTRUN-221:
----------------------------------------

I converted the MWE into an integration test, and amended my PR with it. With 
my changes the ant build receives the prop1 property, without them prop1 is 
null inside the ant build:

{code:none}
[alex@elendil maven-antrun-plugin] (master %=)$ mvn -Prun-its clean verify
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------< org.apache.maven.plugins:maven-antrun-plugin >------------
[INFO] Building Apache Maven AntRun Plugin 3.0.0-SNAPSHOT
[INFO] ----------------------------[ maven-plugin ]----------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-antrun-plugin 
---
[INFO] Deleting /home/alex/dev/maven-antrun-plugin/target
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven-version) @ 
maven-antrun-plugin ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-bytecode-version) @ 
maven-antrun-plugin ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (ban-known-bad-maven-versions) @ 
maven-antrun-plugin ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (ensure-no-container-api) @ 
maven-antrun-plugin ---
[INFO] 
[INFO] --- apache-rat-plugin:0.12:check (rat-check) @ maven-antrun-plugin ---
[INFO] Enabled default license matchers.
[INFO] Will parse SCM ignores for exclusions...
[INFO] Parsing exclusions from /home/alex/dev/maven-antrun-plugin/.gitignore
[INFO] Finished adding exclusions from SCM ignore files.
[INFO] 71 implicit excludes (use -debug for more details).
[INFO] Exclude: src/test/resources/configuration-writer/*.xml
[INFO] Exclude: .repository/**
[INFO] Exclude: .maven/spy.log
[INFO] Exclude: dependency-reduced-pom.xml
[INFO] Exclude: .java-version
[INFO] 106 resources included (use -debug for more details)
[INFO] Rat check: Summary over all files. Unapproved: 1, unknown: 1, generated: 
0, approved: 105 licenses.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.063 s
[INFO] Finished at: 2019-11-26T09:01:25-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.12:check 
(rat-check) on project maven-antrun-plugin: Too many files with unapproved 
license: 1 See RAT report in: /home/alex/dev/maven-antrun-plugin/target/rat.txt 
-> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[alex@elendil maven-antrun-plugin] (master %=)$ mvn -Prun-its clean verify^C
[alex@elendil maven-antrun-plugin] (master %=)$ git checkout MANTRUN-221 -- 
pom.xml
[alex@elendil maven-antrun-plugin] (master +%=)$ mvn -Prun-its clean verify
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------< org.apache.maven.plugins:maven-antrun-plugin >------------
[INFO] Building Apache Maven AntRun Plugin 3.0.0-SNAPSHOT
[INFO] ----------------------------[ maven-plugin ]----------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ maven-antrun-plugin 
---
[INFO] Deleting /home/alex/dev/maven-antrun-plugin/target
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven-version) @ 
maven-antrun-plugin ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-bytecode-version) @ 
maven-antrun-plugin ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (ban-known-bad-maven-versions) @ 
maven-antrun-plugin ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (ensure-no-container-api) @ 
maven-antrun-plugin ---
[INFO] 
[INFO] --- apache-rat-plugin:0.12:check (rat-check) @ maven-antrun-plugin ---
[INFO] Enabled default license matchers.
[INFO] Will parse SCM ignores for exclusions...
[INFO] Parsing exclusions from /home/alex/dev/maven-antrun-plugin/.gitignore
[INFO] Finished adding exclusions from SCM ignore files.
[INFO] 71 implicit excludes (use -debug for more details).
[INFO] Exclude: src/test/resources/configuration-writer/*.xml
[INFO] Exclude: src/it/*/*.json
[INFO] Exclude: .repository/**
[INFO] Exclude: .maven/spy.log
[INFO] Exclude: dependency-reduced-pom.xml
[INFO] Exclude: .java-version
[INFO] 105 resources included (use -debug for more details)
[INFO] Rat check: Summary over all files. Unapproved: 0, unknown: 0, generated: 
0, approved: 105 licenses.
[INFO] 
[INFO] --- maven-plugin-plugin:3.5.2:helpmojo (generate-helpmojo) @ 
maven-antrun-plugin ---
[INFO] Using 'UTF-8' encoding to read mojo source files.
[INFO] java-javadoc mojo extractor found 0 mojo descriptor.
[INFO] java-annotations mojo extractor found 0 mojo descriptor.
[INFO] 
[INFO] --- maven-remote-resources-plugin:1.5:process (process-resource-bundles) 
@ maven-antrun-plugin ---
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ 
maven-antrun-plugin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ 
maven-antrun-plugin ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 10 source files to 
/home/alex/dev/maven-antrun-plugin/target/classes
[INFO] 
[INFO] --- maven-plugin-plugin:3.5.2:descriptor (default-descriptor) @ 
maven-antrun-plugin ---
[INFO] Using 'UTF-8' encoding to read mojo source files.
[INFO] java-javadoc mojo extractor found 0 mojo descriptor.
[INFO] java-annotations mojo extractor found 2 mojo descriptors.
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ 
maven-antrun-plugin ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ 
maven-antrun-plugin ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to 
/home/alex/dev/maven-antrun-plugin/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ 
maven-antrun-plugin ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running 
org.apache.maven.plugins.antrun.AntrunXmlPlexusConfigurationWriterTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.089 s 
- in org.apache.maven.plugins.antrun.AntrunXmlPlexusConfigurationWriterTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] 
[INFO] --- maven-jar-plugin:3.1.0:jar (default-jar) @ maven-antrun-plugin ---
[INFO] Building jar: 
/home/alex/dev/maven-antrun-plugin/target/maven-antrun-plugin-3.0.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-plugin-plugin:3.5.2:addPluginArtifactMetadata 
(default-addPluginArtifactMetadata) @ maven-antrun-plugin ---
[INFO] 
[INFO] --- maven-site-plugin:3.7.1:attach-descriptor (attach-descriptor) @ 
maven-antrun-plugin ---
[INFO] Skipping because packaging 'maven-plugin' is not pom.
[INFO] 
[INFO] --- maven-invoker-plugin:3.1.0:install (integration-test) @ 
maven-antrun-plugin ---
[INFO] Installing /home/alex/dev/maven-antrun-plugin/pom.xml to 
/home/alex/dev/maven-antrun-plugin/target/local-repo/org/apache/maven/plugins/maven-antrun-plugin/3.0.0-SNAPSHOT/maven-antrun-plugin-3.0.0-SNAPSHOT.pom
[INFO] Installing 
/home/alex/dev/maven-antrun-plugin/target/maven-antrun-plugin-3.0.0-SNAPSHOT.jar
 to 
/home/alex/dev/maven-antrun-plugin/target/local-repo/org/apache/maven/plugins/maven-antrun-plugin/3.0.0-SNAPSHOT/maven-antrun-plugin-3.0.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-invoker-plugin:3.1.0:integration-test (integration-test) @ 
maven-antrun-plugin ---
[INFO] Building: classpath-ref-test/pom.xml
[INFO]           classpath-ref-test/pom.xml ....................... SUCCESS 
(2.3 s)
[INFO] Building: attach-artifact-from-ant-task/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           attach-artifact-from-ant-task/pom.xml ............ SUCCESS 
(1.2 s)
[INFO] Building: MANTRUN-172/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           MANTRUN-172/pom.xml .............................. SUCCESS 
(1.1 s)
[INFO] Building: export-ant-properties/pom.xml
[INFO]           export-ant-properties/pom.xml .................... SUCCESS 
(1.4 s)
[INFO] Building: copy-fail-test/pom.xml
[INFO]           copy-fail-test/pom.xml ........................... SUCCESS 
(1.0 s)
[INFO] Building: never-fail-test/pom.xml
[INFO]           never-fail-test/pom.xml .......................... SUCCESS 
(1.0 s)
[INFO] Building: MANTRUN-192/pom.xml
[INFO]           MANTRUN-192/pom.xml .............................. SUCCESS 
(1.1 s)
[INFO] Building: local-repo-prop-test/pom.xml
[INFO]           local-repo-prop-test/pom.xml ..................... SUCCESS 
(1.1 s)
[INFO] Building: MANTRUN-221/pom.xml
[INFO]           MANTRUN-221/pom.xml .............................. FAILED (1.3 
s)
[INFO]   The build exited with code 1. See 
/home/alex/dev/maven-antrun-plugin/target/it/MANTRUN-221/build.log for details.
[INFO] Building: custom-task-test/pom.xml
[INFO]           custom-task-test/pom.xml ......................... SUCCESS 
(1.7 s)
[INFO] Building: tasksattributes-test/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           tasksattributes-test/pom.xml ..................... SUCCESS 
(1.4 s)
[INFO] Building: MANTRUN-178/pom.xml
[INFO]           MANTRUN-178/pom.xml .............................. SUCCESS 
(1.1 s)
[INFO] Building: attach-artifact-test/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           attach-artifact-test/pom.xml ..................... SUCCESS 
(1.2 s)
[INFO] Building: multiple-phase-test/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           multiple-phase-test/pom.xml ...................... SUCCESS 
(1.1 s)
[INFO] Building: custom-ant-target-attributes/pom.xml
[INFO] run post-build script verify.groovy
[INFO]           custom-ant-target-attributes/pom.xml ............. SUCCESS 
(1.4 s)
[INFO] Building: attach-artifact-test-with-prefix-unknown/pom.xml
[INFO]           attach-artifact-test-with-prefix-unknown/pom.xml . SUCCESS 
(1.1 s)
[INFO] Building: properties-test/pom.xml
[INFO]           properties-test/pom.xml .......................... SUCCESS 
(1.1 s)
[INFO] Building: filesets-test/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           filesets-test/pom.xml ............................ SUCCESS 
(1.1 s)
[INFO] Building: ant-1.7-features/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           ant-1.7-features/pom.xml ......................... SUCCESS 
(1.5 s)
[INFO] Building: classpath-test-scope-test/pom.xml
[INFO]           classpath-test-scope-test/pom.xml ................ SUCCESS 
(1.5 s)
[INFO] Building: antrun-default-test/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           antrun-default-test/pom.xml ...................... SUCCESS 
(1.1 s)
[INFO] Building: MANTRUN-179/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           MANTRUN-179/pom.xml .............................. SUCCESS 
(1.1 s)
[INFO] Building: properties-attributes-test/pom.xml
[INFO]           properties-attributes-test/pom.xml ............... SUCCESS 
(1.5 s)
[INFO] Building: env-var-test/pom.xml
[INFO]           env-var-test/pom.xml ............................. SUCCESS 
(1.5 s)
[INFO] Building: task-encoding-test/pom.xml
[INFO]           task-encoding-test/pom.xml ....................... SUCCESS 
(1.1 s)
[INFO] Building: attach-artifact-test-with-prefix/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           attach-artifact-test-with-prefix/pom.xml ......... SUCCESS 
(1.1 s)
[INFO] Building: plugin-classpath-test/pom.xml
[INFO]           plugin-classpath-test/pom.xml .................... SUCCESS 
(3.1 s)
[INFO] 
[INFO] --- maven-checkstyle-plugin:3.0.0:check (checkstyle-check) @ 
maven-antrun-plugin ---
[INFO] 
[INFO] --- maven-invoker-plugin:3.1.0:verify (integration-test) @ 
maven-antrun-plugin ---
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO]   Passed: 26, Failed: 1, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[ERROR] The following builds failed:
[ERROR] *  MANTRUN-221/pom.xml
[INFO] -------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  40.084 s
[INFO] Finished at: 2019-11-26T09:02:25-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-invoker-plugin:3.1.0:verify (integration-test) 
on project maven-antrun-plugin: 1 build failed. See console output above for 
details. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[alex@elendil maven-antrun-plugin] (master +%=)$ grep prop1 
/home/alex/dev/maven-antrun-plugin/target/it/MANTRUN-221/build.log
    <prop1>$.version</prop1>
[DEBUG]   (f) properties = {prop1=$.version}
[DEBUG] Reading value for prop1 with JsonPath expression $.version
[INFO] prop1=3.2.1
[DEBUG]  +Target: -prop1
[DEBUG] Property "prop1" has not been set
[DEBUG] Build sequence for target(s) `main' is [-prop1, main]
[DEBUG] Complete build sequence is [-prop1, main, ]
-prop1:
[DEBUG] Property "prop1" has not been set
[DEBUG]      [fail] failing due to prop1=${prop1} is not equal to 3.2.1
[ERROR] /home/alex/dev/maven-antrun-plugin/target/it/MANTRUN-221/build.xml:28: 
prop1=${prop1} is not equal to 3.2.1
/home/alex/dev/maven-antrun-plugin/target/it/MANTRUN-221/build.xml:28: 
prop1=${prop1} is not equal to 3.2.1
/home/alex/dev/maven-antrun-plugin/target/it/MANTRUN-221/build.xml:28: 
prop1=${prop1} is not equal to 3.2.1
/home/alex/dev/maven-antrun-plugin/target/it/MANTRUN-221/build.xml:28: 
prop1=${prop1} is not equal to 3.2.1
Caused by: org.apache.tools.ant.BuildException: prop1=${prop1} is not equal to 
3.2.1
{code}


> Fails to pass maven properties set in user properties only
> ----------------------------------------------------------
>
>                 Key: MANTRUN-221
>                 URL: https://issues.apache.org/jira/browse/MANTRUN-221
>             Project: Maven Antrun Plugin
>          Issue Type: Bug
>    Affects Versions: 1.8
>            Reporter: Alex Szczuczko
>            Priority: Major
>         Attachments: mwe.zip
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> A user of mine [reported a 
> problem|https://github.com/ASzc/jsonpath-maven-plugin/issues/3] between 
> jsonpath-maven-plugin:set-properties and maven-antrun-plugin:run. My analysis 
> points to a bug in maven-antrun-plugin, introduced in version 1.8 by 
> MANTRUN-178. 
> MANTRUN-178 incorrectly assumes in AntRunMojo#copyProperties() that all 
> properties will be present in mavenProject.getProperties(), and so fails to 
> copy properties set at runtime in session.getUserProperties().
> I've attached a MWE, showing maven-help-plugin:evaluate seeing the property 
> set by jsonpath-maven-plugin:set-properties, and maven-antrun-plugin:run 
> failing to see the same property.
> I intend to file a PR to fix this shortly.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to