I need to download a dependency "proxy-vole" from maven and it is present on "https://artifacts.alfresco.com/nexus/content/groups/public"
So I have mentioned the above url as mirror in my setting.xml in maven but everytime I run the project from maven ,it tries to download the jar file from other url (mirror 2) where this depency doesnot exists. and i get error.
my setting.xml is :
<mirrors>
<mirror>
<id>maven.alfresco</id>
<mirrorOf>alfresco-public</mirrorOf>
<name>alfresco artifacts repository</name>
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>FTRDProxy_central</id>
<mirrorOf>central</mirrorOf>
<name>FTRD Maven Proxy mirroring central (maven 2) repository</name>
<url>url for mirror2</url>
</mirror>
<mirror>
<id>maven.apache</id>
<mirrorOf>maven2</mirrorOf>
<name>Apache Maven Proxy mirroring central (maven 2) repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</mirror>
Related
Need Efficient Solution for moving to HTTPS for mvn clean install build success
Have project with numerous internal dependencies which use http://repo1.maven.org/maven2 & http://repo.spring.io for dependency download
Tried following solutions at my end
Added following settings.xml in ~/.m2/ folder. Tried Profiling options also.
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode/>
<offline/>
<pluginGroups/>
<servers/>
<mirrors>
<mirror>
<id>central-repository</id>
<name>Maven Repository HTTPS</name>
<url>https://repo1.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>central-spring-repository</id>
<name>Spring Repository HTTPS</name>
<url>https://repo.spring.io</url>
<mirrorOf>springcentral</mirrorOf>
</mirror>
<mirror>
<id>organisation-repo1</id>
<name>org-repo1</name>
<url>http://org.maven.com/repo1</url>
<mirrorOf>repo1</mirrorOf>
</mirror>
<mirror>
<id>organisation-repo2</id>
<name>org-repo2</name>
<url>http://org.maven.com/repo2</url>
<mirrorOf>repo2</mirrorOf>
</mirror>
</mirrors>
<proxies/>
<profiles/>
<activeProfiles/>
</settings>
Still faced some issues for internal jars dependencies in the project.
Failed to read artifact descriptor for
com.netflix.hystrix:hystrix-core:jar:1.5.13: Could not transfer
artifact com.netflix.hystrix:hystrix-core:pom:1.5.13 from/to cxf-repo
(http://repo1.maven.org/maven2/): Transfer failed for
http://repo1.maven.org/maven2/com/netflix/hystrix/hystrix-core/1.5.13/hystrix-core-1.5.13.pom 501 HTTPS Required
Added following in pom.xml
<repositories>
<repository>
<id>central-maven</id>
<name>central https Releases</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<id>central-spring</id>
<name>central spring https Releases</name>
<url>https://repo.spring.io</url>
</repository>
<repositories>
Have read this doc for maven central repo movement to HTTPS
https://blog.sonatype.com/central-repository-moving-to-https but couldn't get any proper resolution for internal dependency issue.
Some dependencies in my case are still calling http url's of central and spring
maven
Either upgrade your Maven version
or
Restrict the current Maven version to use HTTPS links by modifying your POM:
Include the following code in pom.xml of your project.
<project>
...
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
taking a backup of .m2 folder and doing clean and install worked for me.
I have no internet access on my project and trying to deploy archiva and use it to create maven projects offline.
So, i downloaded apache archiva and deployed it on my local computer.
Then i created local repository with this settings.
Then i changed settings.xml in maven folder
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>C:/MavenRepository/.m2/repository</localRepository>
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
</servers>
<mirrors>
<mirror>
<id>local.repository</id>
<name>test repo</name>
<url>http://localhost:8888/archiva/repository/local.repository</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>local.repository</id>
<name>local.repository</name>
<url>http://localhost:8888/repository/local.repository/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>local.repository</id>
<name>local.repository</name>
<url>http://localhost:8888/repository/local.repository/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
and then tried to add archetype catalog in maven settings in eclipse but it saying remote catalog is empty
.
What i need to do to get correct archetypes to create maven project in eclipse?
You created a new Maven repository. It is empty. Then you defined it as mirror in your settings.xml. This means that all requests (including the one for archetypes) go to an empty repository.
The same will happen when you try to build anything with Maven. Maven will try to download tons of plugins, JARs, POMs etc. from the Maven repository and will fail.
You will need Internet connection somewhere. You can e.g. connect your archiva to MavenCentral, build your project and then shut down the connection. Or you can do this on another computer and copy the artifacts from one archiva to the other.
Before you create a maven project with Archiva or Nexus, you have make the following settings for Maven.
Go to Maven installation folder and open the file /conf/settings.xml, and add the following for Archiva.
<mirror>
<id>internal</id>
<name>Proxy Cache - Internal Repository</name>
<url>http://localhost:8080/archiva/repository/internal</url>
<mirrorOf>*</mirrorOf>
</mirror>
Configure eclipse with local maven setting. Go to preference in Eclipse, Preference > Maven > Installation and add the local maven setup for eclipse so that Eclipse will know about the local settings.
Then configure the user setting in eclipse with the local maven setting.xml. Go to Preference > Maven > User Settings and click on Browse button to select the /conf/settings.xml file from Maven installation folder.
Finally you can try to create a maven project or you import a Maven project.
I am trying to set up maven with 2 repositories - jcenter & nexus. From nexus, we don't have the ability to proxy to jcenter. Hence I need a set up which can do the following-
If a artifact is found in nexus, download it.
If not found, go to jcenter to download artifact.
With the below settings.xml, it seems like maven only tries to download from central (which is set to bintray here, because its a super set of maven central). How can I tell maven to look in central and nexus?
Note- I have tried <mirrorOf>central, !nexus</mirrorOf>
<mirrors>
<mirror>
<id>bintray</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>nexus</id>
<mirrorOf>!bintray, *</mirrorOf>
<url>http://some/url/goes/here</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>allow-snapshots</id>
<activation><activeByDefault>true</activeByDefault></activation>
<repositories>
<repository>
<id>jcenter</id>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
</profile>
</profiles>
I got it working by specifying multiple repo's in my parent pom. multiple repos in settings.xml had no effect on maven.
I am in a closed network, do not have access to http://repo.maven.apache.org We set up a Nexus server and we download all of our .m2's on a publicly accessible computer, burn to disk, then upload to our Nexus server (inefficient but necessary)
Currently I am trying to set up the system to only use my nexus server, currently it tries to go to http://repo.maven.apache.org
(assuming is set to false) If I have set to true, it does not even attempt to go to my private repo. Basically, I just need my Maven to only look at my nexus instance, not even attempt to go to http://repo.maven.apache.org
Here are portions of my settings.xml and pom.xml files:
<!-- Settings.xml in my .m2 directory -->
<offline>true</offline>
<servers>
<server>
<id>mynexus</id>
<username>xxx</username>
<password>xxx</username>
</server>
<server>
<id>mynexusplugins</id>
<username>xxx</username>
<password>xxx</username>
</server>
</servers>
<!-- pom.xml -->
<repositories>
<repository>
<id>mynexus</id>
<url>http://192.168.100.4:8081/....</url>
</repository>
</repository>
<pluginRepositories>
<pluginRepository>
<id>mynexusplugins</id>
<url>http://192.168.100.4:8081/....</url>
</pluginRepository>
</pluginRepository>
Add your repository as mirror of all in the settings.xml, this way it won't look any other repo.
<mirrors>
<mirror>
<id>yourRepo</id>
<name>yourRepo name</name>
<url>your url</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
https://maven.apache.org/guides/mini/guide-mirror-settings.html
As a side note, If you set offline in maven(via command line or config) it will only use local m2 folder.
In my settings.xml, I redirected everything to my own repository by setting
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://dox4453:8084/nexus/content/groups/public</url>
</mirror>
</mirrors>
But when I use the archetype:generate, I get a warning:
[WARNING] Error reading archetype catalog http://repo.maven.apache.org/maven2
Does this mirroring not apply to archetypes? Or is there something that can overwrite the mirror settings?