Marc Guillemot created MDEP-696:
-----------------------------------

             Summary: copy:dependencies fails with addParentPom using SNAPSHOT
                 Key: MDEP-696
                 URL: https://issues.apache.org/jira/browse/MDEP-696
             Project: Maven Dependency Plugin
          Issue Type: Bug
            Reporter: Marc Guillemot


{{copy:dependencies}} fails with {{addParentPom=true}} when handling snapshots 
(even if there is no parent): it seems to be a mismatch between timestamped and 
-SNAPSHOT files.

Here is a simplified example to reproduce the problem:

First project:
{code:html}
<project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>poc.bug-dependency-plugin</groupId>
        <artifactId>first-project</artifactId>
        <version>0.1-SNAPSHOT</version>
        <distributionManagement>
                <snapshotRepository>
                        <id>test-snapshots</id>
                        
<url>https://svr-nexus01:9443/repository/test-snapshots/</url>
                </snapshotRepository>
        </distributionManagement>
</project> {code}
 

"consumer" project:
{code:html}
<project>
        <modelVersion>4.0.0</modelVersion>
        <groupId>poc.bug-dependency-plugin</groupId>
        <artifactId>consumer</artifactId>
        <version>0.1-SNAPSHOT</version>

        <dependencies>
                <dependency>
                        <groupId>poc.bug-dependency-plugin</groupId>
                        <artifactId>first-project</artifactId>
                        <version>0.1-SNAPSHOT</version>
                </dependency>
        </dependencies>
        <build>
                <pluginManagement>
                        <plugins>
                                <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-dependency-plugin</artifactId>
                                <version>3.1.2</version>
                                <configuration>
                                        <copyPom>true</copyPom>
                                        <addParentPoms>true</addParentPoms>
                                </configuration>
                                </plugin>
                        </plugins>
                </pluginManagement>
        </build>
        <repositories>
                <repository>
                        <id>test-snapshots</id>
                        
<url>https://svr-nexus01:9443/repository/test-snapshots/</url>
                </repository>
        </repositories>
</project> {code}
1. Deploy first project
{code:bash}
mvn deploy{code}
2. Clean local repository
{code:bash}
rm -rf ~/.m2/repository/poc/bug-dependency-plugin{code}
3. Call dependency plugin on consumer project:
{code:bash}
$ mvn -f consumer.pom.xml dependency:copy-dependencies
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< poc.bug-dependency-plugin:consumer >-----------------
[INFO] Building consumer 0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from test-snapshots: 
https://svr-nexus01:9443/repository/test-snapshots/poc/bug-dependency-plugin/first-project/0.1-SNAPSHOT/first-project-0.1-20200514.130323-1.pom
Downloaded from test-snapshots: 
https://svr-nexus01:9443/repository/test-snapshots/poc/bug-dependency-plugin/first-project/0.1-SNAPSHOT/first-project-0.1-20200514.130323-1.pom
 (379 B at 756 B/s)
Downloading from test-snapshots: 
https://svr-nexus01:9443/repository/test-snapshots/poc/bug-dependency-plugin/first-project/0.1-SNAPSHOT/first-project-0.1-20200514.130323-1.jar
Downloaded from test-snapshots: 
https://svr-nexus01:9443/repository/test-snapshots/poc/bug-dependency-plugin/first-project/0.1-SNAPSHOT/first-project-0.1-20200514.130323-1.jar
 (1.5 kB at 9.9 kB/s)
[INFO]
[INFO] --- maven-dependency-plugin:3.1.2:copy-dependencies (default-cli) @ 
consumer ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.754 s
[INFO] Finished at: 2020-05-14T15:04:28+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-dependency-plugin:3.1.2:copy-dependencies 
(default-cli) on project consumer: Error resolving project artifact: Could not 
find artifact poc.bug-dependency-plugin:first-project:pom:0.1-20200514.130323-1 
for project poc.bug-dependency-plugin:first-project:jar:0.1-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to