Difference between repository and pluginrepository

Maven

Maven Problem Overview


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>

Maven Solutions


Solution 1 - Maven

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.

Solution 2 - Maven

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAndroidDevView Question on Stackoverflow
Solution 1 - MavenSahil Mahajan MjView Answer on Stackoverflow
Solution 2 - MavenRajiv NathanView Answer on Stackoverflow