Reputation: 2089
My project is structured like this.
Artifact A
|- depends on hadoop-client.jar
|- cloudera repository is added to pom
pom.xml
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
<id>central</id>
<name>libs-release</name>
<url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
</repository>
Now, A compiles fine, has been packaged as jar and pushed to artifactory (jfrog one)
Artifact B
|- depends on A
|- doesn't have cloudera repo in pom
pom.xml
<dependency>
<groupId>groupId</groupId>
<artifactId>artifact_a</artifactId>
</dependency>
Artifact B is not able to use repo which was added in A and gives error on compilation.
"Could not find artifact org.apache.hadoop:hadoop-client:jar:2.0.0-cdh4.2.0"
Am i missing anything ? Don't want to add cloudera repo in pom of Artifact B.
Upvotes: 4
Views: 4306
Reputation: 10895
Maven does only inherit repository information from parent POMs, but not from dependencies. You can create a third POM C which declares the repository and from which A and B inherit - that will work.
Fell into the same pit a while back… ;)
Upvotes: 5