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

purge-local-repository fails when the dependency was never download yet and copying is declared

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • 2.1
    • None
    • purge-local-repository
    • None

    Description

      Using goal "purge-local-repository" together with "copy-dependencies" leads to failure of build with "dependency is missing" if one of the declared snapshot-dependencies was never downloaded before.

      Example, pom.xml:

      <dependencies>
      	<dependency>
      		<groupId>some.groupid</groupId>
      		<artifactId>some.artifactid</artifactId>
      		<version>1.0-SNAPSHOT</version>
      	</dependency>
      </dependencies>
      <build>
      	<plugins>
      	  <plugin>
      		<groupId>org.apache.maven.plugins</groupId>
      		<artifactId>maven-dependency-plugin</artifactId>
      		<version>2.1</version>
      		<executions>
      			<execution>
      				<id>clean-local-repository</id>
      				<phase>prepare-package</phase>
      				<goals>
      					<goal>purge-local-repository</goal>
      				</goals>
      				<configuration>
      					<reResolve>false</reResolve>
      					<verbose>true</verbose>
      				</configuration>
      			</execution>
      			<execution>
      				<id>copy-artifact</id>
      				<phase>package</phase>
      				<goals>
      					<goal>copy-dependencies</goal>
      				</goals>
      				<configuration>
      					<includeArtifactIds>some.artifactid</includeArtifactIds>
      				</configuration>
      			</execution>
      		</executions>
      	  </plugin>
      	</plugins>
      </build>
      

      In the local maven repository the folder "some.artifactid" should be missing (just delete it manually if you are testing with something which you already have there). Now try to build the project with the given pom. It will fail with the message that dependency is missing.

      If you comment out the execution of purge-local-repository the build will run successfully (maven downloads the declared dependency).
      Otherwise if you comment out the execution of copy-dependencies the build will also run successfully.

      But if you have both executions together declared it will fail as long as the declared dependency is not in the local repository...

      Attachments

        Activity

          People

            Unassigned Unassigned
            amiddima Dieter König
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: