Uploaded image for project: 'Maven Dependency Plugin'
  1. Maven Dependency Plugin
  2. MDEP-298

mvn dependency:sources lists parameters 'classifier' and 'type', but manually overrides them

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1
    • 2.6
    • sources
    • None

    Description

      The documentation of dependency:sources lists the parameters

      This suggests that the mojo could be used to resolve other artifact types as well, a functionality that was requested today in this StackOverflow question: http://stackoverflow.com/q/4734407/342852

      e.g.

      mvn dependency:sources -Dclassifier=javadoc -Dtype=jar
      

      But in the org.apache.maven.plugin.dependency.resolvers.ResolveDependencySourcesMojo source code, both parameters are manually overwritten with the constant values 'java-source' and 'sources', respectively.

      this.classifier = SOURCE_CLASSIFIER;
      this.type = SOURCE_TYPE;
      

      This is clearly in violation of the documented behavior. I suggest these assignments to be replaced with the following code:

      if(StringUtils.isEmpty(this.classifier)){
          this.classifier=SOURCE_CLASSIFIER;
      }
      if(StringUtils.isEmpty(this.type)){
          this.type=SOURCE_TYPE;
      }
      

      Attachments

        Issue Links

          Activity

            People

              pgier Paul Gier
              seanizer Sean Patrick Floyd
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: