Reputation: 1106
We are trying to group maven dependencies inside a seperate maven POM-typed project.
We would like to use this as both a POM-type dependency inside the dependencies node aswell as a BOM (Bill of Materials) inside the de dependencyManagement.
We have an 2 repository inside the company. (Apache Archiva - 2.2.0). One of them is for Snapshots and one of them for releases.
When I try to use the snapshot version, everything works fine, but when i want to use the released version, i keep getting an error because it keeps looking for the dependency inside the central maven repository (where our pom is not located)
To me it seems like the POM-dependency is being searched inside the snapshot repository only.
<properties>
...
<dependency.bla-slf4j-logback-BOM.version>1.0.1</dependency.bla-slf4j-logback-BOM.version>
...
</properties>
<dependencies>
...
<dependency>
<groupId>my.groupid</groupId>
<artifactId>bla-slf4j-logback-BOM</artifactId>
<version>${dependency.bla-slf4j-logback-BOM.version}</version>
<type>pom</type>
</dependency>
...
</dependencies>
<dependencyManagement>
<dependencies>
...
<dependency>
<groupId>my.groupid</groupId>
<artifactId>bla-slf4j-logback-BOM</artifactId>
<version>${dependency.bla-slf4j-logback-BOM.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
...
</dependencies>
</dependencyManagement>
errormessage:
[ERROR] Non-resolvable import POM: Failure to find my.groupid:bla-slf4j-logback-BOM:pom:1.0.1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @ line 234, column 22 -> [Help 2]
used command:
mvn dependency:tree
I checked our archiva, the artifact is present at the expected location. I also checked the local maven directory, the pom dependency was downloaded correctly.
Any ideas why this doesn't work for a released version of our POM-project (1.0.1), but does work for a Snapshot version (1.0.1-SNAPSHOT) of our POM-project.
Upvotes: 1
Views: 2106
Reputation: 1106
The solution was to add the following block of xml to the maven settings.xml file.
<mirrors>
<mirror>
<id>ourcentral</id>
<name>our central</name>
<url>http://mavenrepourl.goes.here</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
This causes it to check our internal maven repository as the central maven repository. (our maven repository has the default central repository as remote repository)
Special thanks to: Hisham kh
Upvotes: 1