David Fradin created MNG-5491: --------------------------------- Summary: Resolve artifact failed because of using repo url instead of repo ID Key: MNG-5491 URL: https://jira.codehaus.org/browse/MNG-5491 Project: Maven 2 & 3 Issue Type: Bug Components: Artifacts and Repositories Affects Versions: 3.0.5 Environment: On several systems as Linux Redhat and Windows Vista Reporter: David Fradin Attachments: settings.xml
We have develop a MOJO that downloads a list of artefacts and makes that operations on them. It works in Maven 3.0.3 but failed in Maven 3.0.5 on resolveArtifact method. It seems to be a regression on Maven 3.0.5 (we don't test on Maven 3.0.4). In attached file, find our settings.xml (we have remove internal information). You can see we have a plugin repository ID and a repository ID that use the same URL repository. When we use our plugin, Maven downloads its dependencies and for example download javax.xml.stream:stax-api:jar:1.0-2 (it makes the same problem on all common artifacts). On local repository, we can see in cat repository/javax/xml/stream/stax-api/1.0-2/_maven.repositories : #NOTE: This is an internal implementation file, its format can be changed without prior notice. #Wed Jul 03 13:30:47 CEST 2013 stax-api-1.0-2.jar>plugin-repository= stax-api-1.0-2.pom>plugin-repository= Then Maven execute our plugin that has to download a list of artifacts. But it failed to download javax.xml.stream:stax-api:jar:1.0-2 Reason is that javax.xml.stream:stax-api:jar:1.0-2 is present on local repository, so it found by Maven but when it tests if it is up-to-date it failed because this file comes from another repository. Explanation : Class : DefaultArtifactResolver Method : private List<ArtifactResult> resolve( RepositorySystemSession session, Collection<? extends ArtifactRequest> requests ) Call Class : DefaultUpdateCheckManager Method : public void checkArtifact( RepositorySystemSession session, UpdateCheck<Artifact, ArtifactTransferException> check ) { [...] if ( isAlreadyUpdated( session.getData(), updateKey ) ) updateKey contains repository.getUrl() and not repository.getID() So isAlreadyUpdated answers yes because artefact as already been downloaded from this URL. But when Maven reads _maven.repositories, it sees that repository ID public-repository is not here so the plugin is considered as unavailable. So we have an artifact that is present in local repository but considered as unavailable by resolve and present by isAlreadyUpdated. So artifact is never updated so the repository ID is not added to _maven.repositories Is it clear ? I hope... -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira