Uploaded image for project: 'Maven Install Plugin'
  1. Maven Install Plugin
  2. MINSTALL-18

Bad algorithm to decide if the main artifact is to be installed or not

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.3
    • Component/s: None
    • Labels:
      None

      Description

      Here' s what's in InstallMojo's execute method:

                      // Here, we have a temporary solution to MINSTALL-3 (isDirectory() is true if it went through compile
                      // but not package). We are designing in a proper solution for Maven 2.1
                      if ( file != null && !file.isDirectory() )
                      {
                          installer.install( file, artifact, localRepository );
                      }
                      else if ( !attachedArtifacts.isEmpty() )
                      {
                          getLog().info( "No primary artifact to install, installing attached artifacts instead." );
                      }
      

      This fails if we're building a JAR with no sources but with an attached artifact and only the attached artifact is created (this is the case when using the clover plugin). In that case, the install mojo tries to install the main artifact which doesn't exist).

      The error is in "!file.isDirectory". In the case of a jar with no sources, this directory will not have been created...

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bentmann Benjamin Bentmann
                Reporter:
                vmassol Vincent Massol
              • Votes:
                2 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: