So I have multi module project made in java. And in one of the modules I had to add new dependency.
<dependency>
<groupId>com.donkey.great</groudId>
<artifactId>DonkeyRoll</artifactId>
<version>LATEST-SNAPSHOT</version>
</dependency>
But when importing libs I am getting error:
Failure to transfer com.donkey.great:DonkeyRoll:LATEST-SNAPSHOT
from https://artifactory.of.greatest.donkey.ever.com/artifactory/libs-release
was cached in the local repostiroy, resolution will not be reattempted until the update interval
of artifactory.of.greatest.donkey.ever.com/artifactory/libs-release has elapsed or update are forced.
Original error: Could not transfer artifact com.donkey.great:DonkeyRoll:LATEST-SNAPSHOT:
Failed to transfer file https://artifactory.of.greatest.donkey.ever.com/artifactory/libs-release/com/donkey/great/DonkeyRoll/LATEST-SNAPSHOT with status code 409
I read that mvn clean install -u could help but not in this case.
I observed that this package is already downloaded with specific version, because some of internals jars in other modules are importing it.
Anyone has idea what could go wrong? :)
Just add this to your pom.xml, and I think it should work for you.
<repositories>
<repository>
<id>oss.sonatype.org-snapshot</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
You can also add below to your settings.xml to make it work.
<profiles>
<profile>
<id>allow-snapshots</id>
<activation><activeByDefault>true</activeByDefault></activation>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
Related
I have a spring-mvc project. In my pom file following dependency was added previously:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.0.0.M5</version>
</dependency>
And repository is:
<repositories>
<repository>
<id>Alfresco Public Repository</id>
<url>https://artifacts.alfresco.com/nexus/content/repositories/public/</url>
</repository>
</repositories>
I deleted repository folder under .m2. After that I was getting following error when I try to build the project(mvn clean install):
The following artifacts could not be resolved: org.springframework:spring-webmvc:jar:5.0.0.M5: Failure to find org.springframework:spring-webmvc:jar:5.0.0.M5 in https://artifacts.alfresco.com/nexus/content/repositories/public/ was cached in the local repository, resolution will not be reattempted until the update interval of Alfresco Public Repository has elapsed or updates are forced
I have added new repository in my pom:
<repositories>
<repository>
<id>Alfresco Public Repository</id>
<url>https://artifacts.alfresco.com/nexus/content/repositories/public/</url>
</repository>
<repository>
<id>repository.spring.milestone</id>
<name>Spring Milestone Repository</name>
<url>http://repo.spring.io/milestone</url>
</repository>
</repositories>
Now I am getting following error:
Failed to collect dependencies at org.springframework:spring-webmvc:jar:5.0.0.M5: Failed to read artifact descriptor for org.springframework:spring-webmvc:jar:5.0.0.M5: Could not transfer artifact org.springframework:spring-webmvc:pom:5.0.0.M5 from/to repository.spring.milestone (http://repo.spring.io/milestone): Access denied to: http://repo.spring.io/milestone/org/springframework/spring-webmvc/5.0.0.M5/spring-webmvc-5.0.0.M5.pom
From browser I can see spring-webmvc-5.0.0.M5.pom.
Why I am getting "Access denied"?
What is the solution of this problem?
Note: I am unable to update the version 5.0.0.M5 to 5.0.0.RELEASE
As per #Sebastian's comment, I have changed http to https at Spring Milestone Repository:
<repository>
<id>repository.spring.milestone</id>
<name>Spring Milestone Repository</name>
<url>https://repo.spring.io/milestone</url>
</repository>
It's working fine now. Thanks #Sebastian
I am working behind a proxy and I am facing SSL issues. Therefore, I can't use HTTPS propertly, so in Eclipse in the settings.xml file of maven I set the repository to "http://repo1.maven.org/maven2", i.e. HTTP, as follows:
<settings>
<activeProfiles>
<activeProfile>securecentral</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>securecentral</id>
<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
It worked for some dependencies but when I added one dependency to the pom.xml specifically this one:
<dependency>
<groupId>com.twelvemonkeys.imageio</groupId>
<artifactId>imageio-tiff</artifactId>
<version>3.3.2</version>
</dependency>
Eclipse couldn't download it (I don't know if this issue is from the proxy, from the repository itself, or some other issue)
My question:
Does setting the repository to "http://repo1.maven.org/maven2" limit the number of plugins, libraries, or anything I can download using the normal repository "https://mvnrepository.com/", or it is exactly the same without any limitation or difference except that the first one is through HTTP not HTTPS ?
I hope you understand that both of these are repositories which include artifacts uploaded via distributionManagement by developers.
They are not same in terms of the endpoint you would reach.
The preferred would be the one for maven central - http://repo1.maven.org/maven2 which can be looked in at https://search.maven.org/
There is a useful link for consumers to start using it. - central.sonatype.org/pages/consumers and the code shared seems to be following that very likely (Consumer - Apache Maven)
I had set up a Nexus Repository to link-up two separate projects. I am building and deploying the RELEASE and SNAPSHOT versions on Nexus successfully but when i am trying to use the changes in other project using maven update this changes are not getting updated.
So what I did in A_Project.jar in one Project which is got updated in nexus repository.
But when I am trying to get this updated jar at B_Project, I am getting the old jar which was there in maven's local repository. Now, if I manually delete the A_Project.jar, i apparently gets the updated code.
For achieving the updated version of SNAPSHOT and RELEASED version i had tried following ways.
I had used -U with mvn clean build.
I have changed the update policy in setting.xml and pom.xml as follows.
In settings.xml
<pluginRepository>
<id>deployment</id>
<name>Internal Nexus Repository</name>
<url>http://server/nexus/content/groups/public/</url>
<layout>default</layout>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
</pluginRepository>
In pom.xml
<repositories>
<repository>
<id>snapshots</id>
<url>http://server/nexus/content/repositories/snapshots</url>
<snapshots>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
Please help as this become a repeated process in getting the latest jar for me.
I can't see enough of your settings.xml to say what is going on. What you have shown is just the pluginRepository section, which is used for resolution of Maven plugins, not artifacts.
I'd suggest starting with a standard settings.xml file:
http://books.sonatype.com/nexus-book/reference/maven-sect-single-group.html
You'll probably want to modify the central repository definition to always look for updates to snapshots:
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
It sounds like you are also trying to re-release the same release versions? This is a bad practice, releases should be considered immutable (and a lot of the toolchain assumes they are). Increment the version number to make a new release.
So I have a project and I do regular releases to maven without a problem. I now want to make available a SNAPSHOT version of this project. So I do 'mvn clean deploy'. Everything works as you can see below:
[INFO] Retrieving previous build number from sonatype-nexus-snapshots
Uploading: https://oss.sonatype.org/content/repositories/snapshots/me/soliveirajr/menta-regex/0.9.6-SNAPSHOT/menta-regex-0.9.6-20111010.153035-2.jar
5K uploaded (menta-regex-0.9.6-20111010.153035-2.jar)
I go to my sonatype manager and I can find the snapshot:
But now when I try to use this snapshot as a dependency on some other project in another machine I get:
<dependency>
<groupId>me.soliveirajr</groupId>
<artifactId>menta-regex</artifactId>
<version>0.9.6-SNAPSHOT</version>
</dependency>
Missing:
1) me.soliveirajr:menta-regex:jar:0.9.6-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=me.soliveirajr -DartifactId=menta-regex -Dversion=0.9.6-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=me.soliveirajr -DartifactId=menta-regex -Dversion=0.9.6-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
So how do I force maven to download the SNAPSHOT version to my local (.m2) repository?
Just add this to your ~/.m2/settings.xml:
<profiles>
<profile>
<id>allow-snapshots</id>
<activation><activeByDefault>true</activeByDefault></activation>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
For the sake of completeness, I would like to add that it is also possible by modifying the pom.xml of a project, simply add
<repositories>
<repository>
<id>oss.sonatype.org-snapshot</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
to your list of repositories.
In my opinion, this is a better solution than modifying ~/.m2/settings.xml. The pom.xml file will also be available for other project participants through Git and allow them to download the snapshots as well.
Source: this answer
You can enable snapshots in repository config (~/.m2/settings.xml):
<settings>
<profiles>
<profile>
<repositories>
<repository>
<snapshots> <<<<<<<<<<<
<enabled>true</enabled> << ADD THIS
</snapshots> <<<<<<<<<<<
. . .
</settings>
See maven.apache.org/settings.html#Repositories for more properties.
I have serious problems on a new computer setting up my existing maven project. Eclipse complains dozens of times about missing artifacts:
Missing artifact junit:junit:jar:4.8.2:test
Missing artifact org.slf4j:slf4j-log4j12:jar:1.5.5:compile
Missing artifact org.slf4j:slf4j-api:jar:1.5.5:compile
Missing artifact log4j:log4j:jar:1.2.14:compile
...
While downloading the files for the local repository I encounter the following message (executing mvn compile:
Downloading: http://repository.jboss.org/maven2/trove/trove/2.1.1/trove-2.1.1.pom
Downloading: http://repository.jboss.org/maven2/trove/trove/2.1.1/trove-2.1.1.pom
....
[ERROR] ... Failed to read artifact descriptor for trove:trove:jar:2.1.1:
Could not transfer artifact trove:trove:pom:2.1.1 from/to jboss
(http://repository.jboss.org/maven2): Access denied to:
http://repository.jboss.org/maven2/trove/trove/2.1.1/trove-2.1.1.pom
I've followed the instructions http://community.jboss.org/wiki/MavenSettings and use the public repository:
<repository>
<id>jboss-public-repository</id>
<name>JBoss Repository</name>
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>>
</repository>
The responsible dependency in my project is
<dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<version>6.0.0.Final</version>
<type>pom</type>
</dependency>
It seems the problem is related to https://issues.jboss.org/browse/JBBUILD-682, but since it's unlikely the repository URL will be fixed, I'm looking for a workaround! I don't encounter this problem on other machines, but it occurs if the maven repository is deleted and will be rebuild.
I think I had that issue once before and afaik know "Using Deprecated Dependencies" helped me.
Have a look at http://community.jboss.org/wiki/MavenGettingStarted-Users on paragraph "Using Deprecated Dependencies". Sorry I might be wrong, but it might be worth a shot... :)
Maven Source Quote:
<repositories>
<!-- other repos here -->
<repository>
<id>jboss-deprecated-repository</id>
<name>JBoss Deprecated Maven Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>