Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is maven looking for artifact in the wrong repo?

I'm defining a dependency in pom.xml in a Maven 3 project. Dependency is as follows:

<dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>el-impl</artifactId>
    <scope>runtime</scope>
    <version>2.2</version>
</dependency>

Repostory is described in pom as follows:

<repository>
    <id>java.net</id>
    <name>java.net</name>
    <url>http://download.java.net/maven/2</url>
</repository>

Artifact is indeed present in the repository. It's easy to check. Despite that, Maven is trying to obtain the artifact from repo1.maven.org. What could be the reason of this? Maybe I make some crucial mistake in defining repository access? Other dependencies seem to do fine.

Plugin org.mortbay.jetty:maven-jetty-plugin:6.1.26 or one of its 
dependencies could not be resolved: Could not find artifact 
org.glassfish.web:el-impl:jar:2.2 
in central (http://repo1.maven.org/maven2)
like image 332
triazotan Avatar asked Jun 03 '11 01:06

triazotan


1 Answers

The repository that you have defined is used for dependencies, but not for plugins. Hence the error.

To address this, you need to define pluginRepositories:

<project>
    <!-- ... -->

    <pluginRepositories>
        <pluginRepository>
            <id>{repo.id}</id>
            <url>{repo.url}</url>
        </pluginRepository>
    </pluginRepositories>
</project>

As to where you should specify - in pom.xml or settings.xml, read this SO post.

like image 139
Raghuram Avatar answered Sep 19 '22 22:09

Raghuram