[
https://jira.codehaus.org/browse/MNG-5185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=363484#comment-363484
]
David Pilato commented on MNG-5185:
-----------------------------------
I'd like to add here my own experience though it could be caused by some bad
maven practices.
I have a project A which defines in its {{pom.xml}} a repository with a given
id:
{code:xml}
<repository>
<id>lucene-snapshots</id>
<url>https://download.elasticsearch.org/lucenesnapshots/1657571</url>
</repository>
{code}
I have a project B which defines in its {{pom.xml}} a repository with another
id:
{code:xml}
<repository>
<id>another-id</id>
<url>https://download.elasticsearch.org/lucenesnapshots/1657571</url>
</repository>
{code}
Because of the {{_maven.repositories}} and {{_remote.repositories}} files,
{{mvn compile}} can not work for the second project and the error raised
appears super strange: {{Access denied to: URL_HERE, ReasonPhrase:
Forbidden.}}. Removing local files in {{~/.m2/repository}} fixes the "remote"
issue... o_O
{code}
find ~/.m2/repository -name _remote.repositories -exec rm -v {} \;
find ~/.m2/repository -name _maven.repositories -exec rm -v {} \;
{code}
It means here that even though projects A and B might not be related at all,
one can not compile because of a repository {{id}} in another project.
I would like to:
* fix the message and give more clue to the users (it took me multiple hours to
find it)
* fix the way maven deals with those local files in case of you have multiple
ids for the same repository. May be try all of them before failing?
I hope my feedback could help.
Best!
> Improve "missing dependency" error message when
> _maven.repositories/_remote.repositories contains other repository ids than
> requested
> -------------------------------------------------------------------------------------------------------------------------------------
>
> Key: MNG-5185
> URL: https://jira.codehaus.org/browse/MNG-5185
> Project: Maven
> Issue Type: Improvement
> Affects Versions: 3.0.2, 3.0.3, 3.0.4
> Reporter: Mark Derricutt
> Assignee: Olivier Lamy
> Fix For: Issues to be reviewed for 4.x
>
> Attachments:
> 0001-MNG-5185-Warn-about-artifacts-present-but-not-available-eclipse-aether.patch,
> 0001-MNG-5185-Warn-about-artifacts-present-but-not-availa.patch
>
>
> Based on a discussion on the users list [1], [Maven 3 has changed how it
> resolves artifacts from local
> repositories|https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-ResolutionfromLocalRepository].
> Unfortunately, when "conflicts" arise (GAV is cached in local repo, but
> restricted to some repository ids, and actual POM has no matching repository
> id declared), Maven just tells the user that the artifact could not be
> resolved.
> This leads to confusion from users who find the .jar files in their local
> repository without knowing this restriction feature: they just get frustrated
> and complain that "maven sucks".
> It would be good if Maven was updated with some improved error messages along
> the lines of:
> "The (GAV) artifact was found in your local repository, but came from remote
> repository "xxx": either configure this in your pom with (insert sample XML
> block in error message), or in your "yyy" mirror."
> The "mirror" section of the error message should be included -if- the current
> ~/.m2/settings.xml declares a mirror. By improving the messages here we can
> help the users move on to building software, rather than pulling out their
> hair :)
> [1]
> http://maven.40175.n5.nabble.com/Maven-3-maven-repositories-and-lastUpdated-td4927537.html
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)