Reputation: 11
I have already working project which downloading .jar bundles from private repositories in Artifactory, and I'm trying to add another repository from which maven will donwload regular maven dependencies.
I've added repository tag to my parent's POM
<repository>
<id>MyId-1</id>
<url>https://artifactory-url/artifactory/Myfolder-1/</url>
<layout>default</layout>
</repository>
to settings.xml
<server>
<id>MyId-1</id>
<username>{username}</username>
<password>{password}</password>
</server>
But it still not found my expected dependencies.
Also in my settings.xml has defined proxy mirror to Artifactory:
<mirrors>
<mirror>
<id>MyId-2</id>
<mirrorOf>central</mirrorOf>
<name>MyName-2</name>
<url>https://artifactory-url/artifactory/Myfolder-2/</url>
</mirror>
</mirrors>
And when i change mirror's URL to my expected URL:
https://artifactory-url/artifactory/Myfolder-1/
Maven successfully downloading my expected dependencies, but doesn't download all others jars.
I also have tried add another one mirror to my settings.xml, and my mirrors tag looks like:
<mirrors>
<mirror>
<id>MyId-2</id>
<mirrorOf>central</mirrorOf>
<name>MyName-2</name>
<url>https://artifactory-url/artifactory/Myfolder-2/</url>
</mirror>
<mirror>
<id>MyId-1</id>
<mirrorOf>*</mirrorOf>
<name>MyName-1</name>
<url>https://artifactory-url/artifactory/Myfolder-1/</url>
</mirror>
</mirrors>
But maven ignores it and I'm getting error when trying mvn install:
Could not find artifact {my-artifact}:pom:{version} in artifactory (https://artifactory-url/artifactory/Myfolder-2/)
The POM for {my-artifact}:jar:{version} is missing, no dependency information available
Upvotes: 1
Views: 1571
Reputation: 11
Seems like mirror tag messed everything up. Resolved this : Removed mirroring central, and added to active profile both folders with jars, so now my repositories tag in settings.xml is :
<repository>
<id>MyId-1</id>
<url>https://artifactory-url/artifactory/Myfolder-1/</url>
</repository>
<repository>
<id>central</id>
<url> https://artifactory-url/artifactory/Myfolder-2/ </url>
<repository>
Upvotes: 0
Reputation: 299
The best practice for using more than one repository is to configure a virtual repository in Artifactory. Then you can aggregate all of your remote and local repositories inside this virtual repository and point your Maven "settings.xml" to this one virtual repository. All of your dependencies and jars will be able to be downloaded from there. For more information about virtual repositories visit JFrog's wiki page here.
Upvotes: 3