[ 
https://issues.apache.org/jira/browse/MDEP-569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16033422#comment-16033422
 ] 

Guillaume Boué commented on MDEP-569:
-------------------------------------

[{{dependency:get}}|https://maven.apache.org/plugins/maven-dependency-plugin/get-mojo.html]
 currently has a restriction that it will always check the central repository, 
before the repositories configured in {{remoteRepositories}}. Since the 
artifact {{io.confluent:kafka-schema-registry:3.1.1}} does not exist on 
Central, and exists in the given remote repository, Maven will create a 
{{.lastUpdated}} storing this information.

When {{dependency:copy}} is ran, Maven will try to work on the artifact 
{{io.confluent:kafka-schema-registry:3.1.1}} but, at that moment, the active 
remote repository is only Maven Central. Since the download from Central failed 
before, Maven also fails, and says it will try to resolve it from central if 
forced or the update interval has passed. This change was introduced in Maven 
3, see MNG-5181 for more info.

So a possible work-around is to work on a project where the 
{{http://packages.confluent.io/maven/}} repository is active, or add this 
repository to your settings. After that, the command {{mvn 
org.apache.maven.plugins:maven-dependency-plugin:3.0.1:get 
org.apache.maven.plugins:maven-dependency-plugin:3.0.1:copy 
-Dartifact=io.confluent:kafka-schema-registry:3.1.1}} will work fine (because 
Maven detects that the artifact {{io.confluent:kafka-schema-registry:3.1.1}} 
was downloaded from the Confluent repo, and this is an active repository for 
the build).

> copy fails on artifacts previously downloaded via get from repo specified via 
> CLI
> ---------------------------------------------------------------------------------
>
>                 Key: MDEP-569
>                 URL: https://issues.apache.org/jira/browse/MDEP-569
>             Project: Maven Dependency Plugin
>          Issue Type: Bug
>          Components: copy, get
>    Affects Versions: 3.0.1
>         Environment: Apache Maven 3.5.0 
> (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T19:39:06Z)
> Maven home: /usr/share/maven
> Java version: 1.8.0_121, vendor: Oracle Corporation
> Java home: /usr/lib/jvm/java-1.8-openjdk/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "4.8.0-52-generic", arch: "amd64", family: "unix"
>            Reporter: Tom Wieczorek
>         Attachments: dependency-copy-problem-output.txt
>
>
> {{dependency:copy}} fails to copy artifacts that were previously downloaded 
> via {{dependency:get}} from a remote repository that has been specified on 
> the command line. The error message is:
> bq. The POM for artifact is missing, no dependency information available
> and later on
> bq. Failed to execute goal dependency:copy (default-cli) on project 
> standalone-pom: Unable to find/resolve artifact. Failure to find artifact in 
> https://repo.maven.apache.org/maven2 was cached in the local repository, 
> resolution will not be reattempted until the update interval of central has 
> elapsed or updates are forced
> But: {{dependency:get}} actually succeeded and the artifact and its POM are 
> in the local repo.
> {code:none|title=Reproducing shell snippet}
> mvn -version
> mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.1:get \
>     org.apache.maven.plugins:maven-dependency-plugin:3.0.1:copy \
>     -DremoteRepositories=http://packages.confluent.io/maven/ \
>     -Dartifact=io.confluent:kafka-schema-registry:3.1.1
> ls -la ~/.m2/repository/io/confluent/kafka-schema-registry/3.1.1
> {code}
> I've attached the output of the above test snippets.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to