AndroidDev
AndroidDev

Reputation: 16395

Difference between repository and pluginrepository

My Android Maven project pom.xml contains the following entries. Now everything works fine. What is the difference between <repositories> entries and the <pluginRepositories> entries.

<repositories>
    <repository>
        <id>my-repo</id>
                <url>http://10.10.10.230:8081/nexus/content/groups/public</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>my-repo</id>
        <name>my-repo</name>
      <url>http://10.10.10.230:8081/nexus/content/groups/public/</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
             <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

Upvotes: 77

Views: 94935

Answers (2)

Rajiv Nathan
Rajiv Nathan

Reputation: 181

Maven will resolve plugin dependencies using the configured pluginRepository. Other artifact dependencies (eg. a parent pom) are resolved using repository. Note: Things available on maven central will be resolved by default so you wouldn't normally need to include repository for those.

For example, if your pom.xml specifies a parent pom and a plugin dependency that both exist in the same repository you must still specify both repository AND pluginRepository. If you only configure one then maven will complain with "Unresolvable X" errors.

Upvotes: 16

Sahil Mahajan Mj
Sahil Mahajan Mj

Reputation: 11141

As @otakun85 stated, There is no technical difference at all. It's for having different configurations->behavior for plugins in contrary to normal artifacts. See repository vs. pluginRepository for more details.

Also check maven-users mailing list archives, It provides quite good explanation to it.

Upvotes: 30

Related Questions