I set up a nexus repo for maven, I have deployed a snapshot but I can't get it anyway. No problem on release version.
Snapshot in the repo
what I get in my local repo
cannot get the jar
can get the metadata
Maven Setting
<mirror>
<id>maven-public</id>
<mirrorOf>*</mirrorOf>
<name>maven-public</name>
<url>http://nexus:8081/repository/maven-public/</url>
</mirror>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>public</id>
<name>maven-public</name>
<url>http://nexus:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<url>http://nexus:8081/repository/maven-public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
If the metadata is getting cached . try using mvn -U to the update the cached local repository.
Related
We have no problem building Spring Boot RELEASE projects with our Nexus repository which proxies maven-central and use a maven-public group. A Spring Boot SNAPSHOT project won't build, because Maven cannot resolve the SNAPSHOT dependencies. Spring SNAPSHOTS get downloaded, but then we get this error message.
Failure to find org.springframework.cloud:spring-cloud-starter-zipkin:jar:2.2.0.BUILD-SNAPSHOT
in http://[host]:8081/repository/[snapshots] was cached in the local
repository, resolution will not be reattempted until the update
interval of [snapshots] has elapsed or updates are forced
Here are the settings:
<settings>
<mirrors>
<mirror>
<id>nexus-proxy-maven-central</id>
<name>maven-central</name>
<url>http://[host]/repository/maven-central</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>maven-public</id>
<name>maven-public</name>
<url>http://[host]/repository/maven-public</url>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestone</id>
<name>Spring Milestone Repository</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
<pluginRepository>
<id>maven-public</id>
<name>maven-public</name>
<url>http://[host]/repository/maven-public</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<servers>
<server>
<id>[snapshots]</id>
<username>*</username>
<password>*</password>
</server>
<server>
<id>[releases]</id>
<username>*</username>
<password>*</password>
</server>
<server>
<id>maven-public</id>
<username>*</username>
<password>*</password>
</server>
<server>
<id>maven-central</id>
<username>*</username>
<password>*</password>
</servers>
</settings>
The pom looks like this:
<distributionManagement>
<repository>
<id>[releases]</id>
<url>https://[host]/repository/[releases]/</url>
</repository>
<snapshotRepository>
<id>[snapshots]</id>
<url>https://[host]/repository/[snapshots]/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>repository.spring.snapshot</id>
<name>Spring Snapshot Repository</name>
<url>http://repo.spring.io/snapshot</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>repository.spring.milestone</id>
<name>Spring Milestone Repository</name>
<url>http://repo.spring.io/milestone</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>[releases]</id>
<name>[releases]</name>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots><enabled>false</enabled></snapshots>
<url>http://[host]/repository/[releases]</url>
<layout>default</layout>
</repository>
<repository>
<id>[snapshots]</id>
<name>[snapshots]</name>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
<url>http://[host]/repository[snapshots]</url>
<layout>default</layout>
</repository>
</repositories>
I've trying building with and without a Nexus proxy for Spring Snapshots, but it didn't help.
The problem is that 2.2.0.BUILD-SNAPSHOT is not publically available at http://repo.spring.io/snapshot at this time. The highest version available is 2.1.2.BUILD-SNAPSHOT. I was working with a Pivotal employee who must have access to higher build numbers earlier than the public. I backed my pom.xml down to 2.1.1.RELEASE and it worked.
I have a jira trying to download dependencies from the server. I have a repository that is configured and works great. This repository duplicates data from the server (in fact it is a secure gateway).
BUT somehow jira tries to connect directly to the server, at the same time it refers to the repository: 3
I thought that in jira connection with the network and with the Internet is configured in maven. Maybe I'm wrong ?
here are the settings of the mavena setting.xml lying in (atlassian-plugin-sdk-6.2.14 \ apache-maven-3.2.1 \ conf)
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<profiles>
<profile>
<repositories>
<repository>
<id>maven-public</id>
<url>http://n7701-sys274:8081/artifactory/maven-public</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
<repository>
<id>maven-external</id>
<url>http://n7701-sys274:8081/artifactory/maven-external</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
<repository>
<id>maven2</id>
<url>http://n7701-sys274:8081/artifactory/maven2/</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
<repository>
<id>public</id>
<url>http://n7701-sys274:8081/artifactory/public/</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<url>http://n7701-sys274:8081/artifactory/public/</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</pluginRepository>
<pluginRepository>
<id>maven2</id>
<url>http://n7701-sys274:8081/artifactory/maven2/</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</pluginRepository>
<pluginRepository>
<id>maven-external</id>
<url>http://n7701-sys274:8081/artifactory/maven-external</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</pluginRepository>
<pluginRepository>
<id>maven-public</id>
<url>http://n7701-sys274:8081/artifactory/maven-public</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
Unless I am mistaken your problem is that:
you properly configure maven to retrieve artifacts from your artifactory server
maven downloads a batch of artifacts from artifactory and resolves them
maven then tries to download transitive dependencies from maven central
Maven central is a special pre-configured repository, injected through automatic POM inheritance.
So your artifacts are resolved both in the repositories defined in your own settings.xml and in maven central
In a nutshell, you need to define in your settings.xml that your artifactory server acts as a mirror to maven central, with the following snippet
...
<mirrors>
<mirror>
<id>central-proxy</id>
<name>Artifactory proxy of central repo</name>
<url>http://n7701-sys274:8081/artifactory/maven-public</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
...
Note that closely related to this question is Disable Maven central repository
My answer is a combination of the solutions to this question.
I would like to secure the connection to repo.maven.apache.org when resolving dependencies (I wolud like to secure all connections made by Maven actually), but I'm not used to Maven configuration... My user settings.xml contains the following repositories and pluginRepositories sections:
<profiles>
<profile>
<id>main</id>
<repositories>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo.maven.apache.org</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
However Maven is unable to resolve dependencies with that setup.
Open the file $MAVEN_HOME/conf/settings.xml (where $MAVEN_HOME is the folder in which Maven has been installed) in a text editor. Then, add the following to the <mirrors>...</mirrors> section in this file:
<mirror>
<id>central-secure</id>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
I have a maven repo which stores all the artifacts under
http://example.com/content/public
I have a second repo which stores different artifacts under
http://example.com/content/type1
By default for all the builds I want to get the artifacts from "content/public"
But for one specific usecase when a flag is switched on I want to get artifacts from "content/type1"
If an artifact is not present then I want to look for it in "content/public"
My apache-maven/3.04./conf/settings.xml looks like this
<mirrors>
<mirror>
<!-- This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*,!type1</mirrorOf>
<url>http://example.com/content/public</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>nexus</id>
<!-- Enable snapshots for the built in central repo to direct -->
<!-- all requests to nexus via the mirror -->
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled><updatePolicy>never</updatePolicy></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<!-- Default this property so we can create references easily. -->
<nexusHostName>example.com</nexusHostName>
</properties>
</profile>
</profiles>
<activeProfiles>
<!-- make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
My profile in the pom.xml looks like this
<profile>
<id>type1-build</id>
<activation>
<property>
<name>type1</name>
<value>true</value>
</property>
</activation>
<repositories>
<repository>
<id>type1</id>
<name>Type1 Repo</name>
<url>http://${nexusHostName}/content/groups/type1/</url>
<layout>default</layout>
<!-- Enforce strict checksums and always update releases and snapshots -->
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
<repository>
<id>nexus</id>
<name>Nexus</name>
<url>http://${nexusHostName}/content/groups/public/</url>
<layout>default</layout>
<!-- Enforce strict checksums and always update releases and snapshots -->
<releases>
<enabled>false</enabled>
<checksumPolicy>fail</checksumPolicy>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
</profile>
Even after doing this when i run a goal like mvn goal1 -Dtype1=true it still looks for artifacts in "content/public"
Can someone please tell me what is that I am doing wrong
Just change the order of your repositories content/type1 first and then content/public
I've added a 3rd party jar into my artifactory (libs-release repos, and its the microsoft jdbc 4 connector).
The problem i have is that maven/apache servicemix fail to download the jar as they have the following setup, and it seems like they always attempt to download stuff from the remote-repos first.
<mirrors>
<mirror>
<mirrorOf>*</mirrorOf>
<name>remote-repos</name>
<url>http://...:8081/artifactory/remote-repos</url>
<id>remote-repos</id>
</mirror>
</mirrors>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://...:8081/artifactory/libs-release</url>
</repository>
<repository>
<snapshots/>
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://...:8081/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://...:8081/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots/>
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://...:8081/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
Any ideas whats wrong/how i can fix this? A temp fix is to install the jar into my local repos, but i dont want to do that on other work pcs.
Cheers.
'remote-repos' repository in Artifactory is a virtual repository which aggregates, well, remote repositories :) Since you added your jar to your local repository, it can't be resolved from 'remote-repos'. Pointing your mirror-any to 'repo' should do the job.