Uploaded image for project: 'Maven Plugin Tools'
  1. Maven Plugin Tools
  2. MPLUGIN-163

Mojo parameters defined in abstract-mojo class not set, when concrete/abstract mojo class in different JARs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 2.5.1
    • None
    • None

    Description

      Have an abstract mojo class, which extends AbstractMojo. This abstract class defines some mojo parameters with expressions to set default values.

      Have a concrete class, in the same project (JAR) and package, which simply extends the abstract mojo class. This works fine, in that the parameter values are initialized correctly.

      Have an identical concrete class, but this time in a different project which defines a Maven dependency on the previous JAR. This time the parameters defined in the abstract class are not initialized correctly. Whether this second concrete mojo is in the same Java package as the abstract class, or not, does not seem to make a difference.

      I have attached a ZIP file which demonstrates the problem. Included are three very simple Maven modules, all created with "mvn archetype:create". The first project, "testplugin-one" contains an abstract and a concrete Mojo class. The second project, "testplugin-two" contains just a concrete Mojo class. The third project "testplugin-driver" contains a POM that invokes the two mojos: the first time the parameters have values, the second time they are null.

      Attachments

        1. abstractmojotest.zip
          10 kB
          Shash Chatterjee

        Issue Links

          Activity

            People

              bentmann Benjamin Bentmann
              chatterj Shash Chatterjee
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: