Uploaded image for project: 'Maven Antrun Plugin'
  1. Maven Antrun Plugin
  2. MANTRUN-40

Properties defined in pom <properties> do not propagate to the antrun environment

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 1.1
    • 1.4
    • None

    Description

      Properties defined in pom <properties> do not propagate to the antrun environment.

      For example:

      <properties>
          <my.property>foo</my.property>
      </properties>
      

      Does not get propagate to Ant. While properties defined within the pom will resolve, the properties are not available as an Ant property. So from antrun:

      <ant antfile="${pom.basedir}/src/ant/build.xml" dir="${pom.basedir}" inheritAll="true" inheritRefs="true" target="foo"/>
      

      And then the Ant build.xml:

      <project>
          <target name="foo">
              <echo>${my.property}</echo>
          </target>
      <project>
      

      The output will be:

      [echo] ${my.property}
      

      Instead of what it should be:

      [echo] foo
      

      The workaround is to delegate to a build.xml file with the ant task and redefine each property that is needed:

      <ant antfile="${pom.basedir}/src/ant/build.xml" dir="${pom.basedir}" inheritAll="true" inheritRefs="true" target="foo">
          <property name="my.property" value="${my.property}"/>
      </ant>
      

      Attachments

        Issue Links

          Activity

            People

              pgier Paul Gier
              jason@planet57.com Jason Dillon
              Votes:
              18 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: