Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6952

Fail fast if pom cannot be transformed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.0
    • 4.0.0-alpha-2, 4.0.0
    • POM
    • None

    Description

      maven-antrun-plugin\target\it\attach-artifact-test-with-prefix fails with the build/consumer.

      The pom contains this:

                  <configuration>
                    <customTaskPrefix>mvn</customTaskPrefix>
                    <target>
                      <mvn:attachartifact file="test.txt" classifier="cl" />
                    </target>
                  </configuration>
      

      And fails during install:install with

      org.xml.sax.SAXParseException; lineNumber: 44; columnNumber: 71; The prefix "mvn" for element "mvn:attachartifact" is not bound.
      

      It is fine that Maven complains about invalid XML, but during install is too late.
      It should happen not at all, or already while making the buildplan.
      If inheritence of such configuration still works, I'd prefer to break the build early.

      The proper fix is to make it valid XML, by specifying the namespace like this:

                  <configuration xmlns:mvn="maven.apache.org/antrun">
                    <customTaskPrefix>mvn</customTaskPrefix>
                    <target>
                      <mvn:attachartifact file="test.txt" classifier="cl" />
                    </target>
                  </configuration>
      

      This already works (even with Maven 3.0), and ideally maven-antrun-plugin also provides an XSD, so it can be validated.

      Attachments

        Issue Links

          Activity

            People

              rfscholte Robert Scholte
              rfscholte Robert Scholte
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: