maven setup another repository for certain dependency - maven-2

I have Maven2 project. All dependencies except one are downloaded from public repository http://repo.maven.apache.org/maven2/.
But I have 1 dependency which I need to download from internal company's repository (we use Sonatype Nexus to store this dependency).
Also, I don't want to create full copy of public repo on my internal repo.
At this moment I have in pom.xml:
<url>http://maven.apache.org</url>
and
<repositories>
<repository>
<id>thirdparty</id>
<url>http://<my_nexus_server_ip>:8081/nexus/content/repositories/thirdparty</url>
</repository>
</repositories>
So, during build I see a lot of trash messages (in this case first line is a trash):
Downloading: http://<my_nexus_server_ip>:8081/nexus/content/repositories/thirdparty/ant/ant/1.6.5/ant-1.6.5.pom
Downloading: http://repo.maven.apache.org/maven2/ant/ant/1.6.5/ant-1.6.5.pom
Downloaded: http://repo.maven.apache.org/maven2/ant/ant/1.6.5/ant-1.6.5.pom (861 B at 3.2 KB/sec)
I want to clearly point Maven for which dependency it have to use internal repository and ignore it for others dependencies (and point that for others dependencies Maven2 have to use public repository).
Could you please help to implement such behavior in Maven?
Thanks In Advance!

According to this answer, it is not possible to set a specific repository for for some of the declared dependencies.

You need to configure the public repository group in Nexus to be used the only one in your Maven builds like the following:
<settings>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:8081/nexus/content/groups/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></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
You have to setup a separate repository in nexus like you described a repo called ThirdParty and add this repository into the configuration of the public repository group. Furthermore you need to upload the one dependency into that particular repository. Apart from that you should have to use the release and SNAPSHOT repository which means you need to configuration your distributionManagement accordingly in your company master pom file.

Related

Minecraft doesn't run through eclipse [duplicate]

Recently Maven build jobs running in Jenkins are failing with the below exception saying that they couldn't pull dependencies from Maven Central and should use HTTPS. I'm not sure how to change the requests from HTTP to HTTPS. Could someone guide me on this matter?
[ERROR] Unresolveable build extension:
Plugin org.apache.maven.wagon:wagon-ssh:2.1 or one of its dependencies could not be resolved:
Failed to collect dependencies for org.apache.maven.wagon:wagon-ssh:jar:2.1 ():
Failed to read artifact descriptor for org.apache.maven.wagon:wagon-ssh:jar:2.1:
Could not transfer artifact org.apache.maven.wagon:wagon-ssh:pom:2.1 from/to central (http://repo.maven.apache.org/maven2):
Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.1/wagon-ssh-2.1.pom.
Return code is: 501, ReasonPhrase:HTTPS Required. -> [Help 2]
Waiting for Jenkins to finish collecting data[ERROR]
Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1:
Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo.maven.apache.org/maven2):
Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom.
Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]
The reason for the observed error is explained in Central 501 HTTPS Required
Effective January 15, 2020, The Central Repository no longer supports
insecure communication over plain HTTP and requires that all requests
to the repository are encrypted over HTTPS.
It looks like latest versions of Maven (tried with 3.6.0, 3.6.1) are already using the HTTPS URL by default.
Here are the dates when the major repositories will switch:
Your Java builds might break starting January 13th (if you haven't yet switched repo access to HTTPS)
Update: Seems like from maven 3.2.3 maven central is accessed via HTTPS
See https://stackoverflow.com/a/25411658/5820670
Maven Change log
(http://maven.apache.org/docs/3.2.3/release-notes.html)
I am facing the same problem. There are two solutions that I tried, and both works fine for me.
Update the Maven version repository (Maven version >= 3.2.3)
Restrict the current Maven version to use HTTPS links.
Update the Maven version repository:
Download the Apache Maven binary that includes the default https addresses (Apache Maven 3.6.3 binary). And open the Options dialog window in tools of NetBeans menu bar (Java Maven Dialog View). And select browse option in Maven Home List Box (Maven Home List Box View). After adding the Apache Maven newly downloaded version (Updated Maven Home List Box View), the project builds and runs successfully.
Restrict the current Maven version to use HTTPS links:
Include the following code in pom.xml of your project.
<project>
...
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<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>
</project>
Effective January 15, 2020, The Central Repository no longer supports
insecure communication over plain HTTP and requires that all requests
to the repository are encrypted over HTTPS.
If you're receiving this error, then you need to replace all URL
references to Maven Central with their canonical HTTPS counterparts.
(source)
We have made the following changes in my project's build.gradle:
Old:
repositories {
maven { url "http://repo.maven.apache.org/maven2" }
}
New:
repositories {
maven { url "https://repo.maven.apache.org/maven2" }
}
Try to hit the below URL in any browser. It will return 501
http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.1/wagon-ssh-2.1.pom
Please try with https. It will download a pom.xml file:
https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.1/wagon-ssh-2.1.pom
Please add it (https://repo.maven.apache.org/maven2) in the setting.xml file:
<repositories>
<repository>
<id>Central Maven repository</id>
<name>Central Maven repository https</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
I was using a clean install of Maven/Java on a Docker container.
For me, I had to cd $M2_HOME/conf and edit the settings.xml file there. Add the following block inside <mirrors>...</mirrors>
<mirror>
<id>central-secure</id>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
Update the central repository of Maven and use https instead of http.
<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>
Add this in pom.xml file. It works fine for me
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<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>
Maven is moving to HTTPS and disabling HTTP access
Short story, from January 15, 2020, Maven Central repository is not longer supporting HTTP connections (other repositories are doing the same). Therefore, you will indicate your Maven/Gradle settings to use an HTTPS URL.
Solution:
You can choose one of the following three approaches.
Add a repository in your project´s pom.xml file
<project>
...
<repositories>
<repository>
<id>central maven repo</id>
<name>central maven repo https</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
</project>
Add the repository into a profile in the settings.xml file.
<profile>
<id>my profile</id>
<repositories>
<repository>
<id>central maven repo</id>
<name>central maven repo https</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
</profile>
Update you maven version to a new one that uses https values as default. The lastest one at this moment 3.6.3 Download here
For Gradle:
Only replace the URL for the HTTPS version.
repositories {
maven { url "https://repo.maven.apache.org/maven2" }
}
I was added following code segment to setting.xml and it was resolved the issue,
<mirrors>
<mirror>
<id>maven-mirror</id>
<name>Maven Mirror</name>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
I was using an outdated version of Maven (3.0.3 and 3.1). These older versions no longer supports http repositories (as mentioned above). Upgrading to Maven 3.6 was the fix for me.
As stated in other answers, https is now required to make requests to Maven Central, while older versions of Maven use http.
If you don't want to/cannot upgrade to Maven 3.2.3+, you can do a workaround by adding the following code into your MAVEN_HOME\conf\settings.xml into the <profiles> section:
<profile>
<id>maven-https</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
This will be always an active setting unless you disable/override it in your POM when needed.
I have the same issue, but I use GitLab instead of Jenkins. The steps I had to do to get over the issue:
My project is in GitLab so it uses the .yml file which points to a Docker image I have to do continuous integration, and the image it uses has the http://maven URLs. So I changed that to https://maven.
That same Dockerfile image had an older version of Maven 3.0.1 that gave me issues just overnight. I updated the Dockerfile to get the latest version 3.6.3
I then deployed that image to my online repository, and updated my Maven project ymlfile to use that new image.
And lastly, I updated my main projects POM file to reference https://maven... instead of http://maven
I realize that is more specific to my setup. But without doing all of the steps above I would still continue to get this error message
Return code is: 501 , ReasonPhrase:HTTPS Required
For me (corporate coder) also adding a mirror repository in the settings.xml fixed the issue. I am also using Maven inside a docker container.
<mirrors>
<mirror>
<id>https-mirror</id>
<name>Https Mirror Repository</name>
<url>https://repo1.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
For all the corporate coders, ideally,
if you get this error, it means that your code base is still being built from open-source community. You need to over ride the "central" repository with your in house company Maven repository manager.
You can go to your settings.xml and override your central repository URL from http:// to https://
<M2_HOME>/conf/settings.xml
Find the mirrors sections and add the following entry:
<mirror>
<id>other-mirror</id>
<name>Other Mirror Repository</name>
<url>https://other-mirror.repo.other-company.com/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
In the URL section, if you were using either http://repo1.maven.org/maven2/ or http://repo.maven.apache.org/maven2/ then
Replace http://repo1.maven.org/maven2/ with https://repo1.maven.org/maven2/
Replace http://repo.maven.apache.org/maven2/ with https://repo.maven.apache.org/maven2/
You need to ideally use your company source control management/repository URL over here. As this will block any contact with open source Maven repository community.
As mentioned in other answers, effective from 15 January 2020, the central Maven repository doesn't support insecure communication over plain HTTP.
If you are using Netbeans older version, you have to make changes in maven to use https over http
Open C:\Program Files\NetBeans8.0.2\java\maven\conf\settings.xml
and paste below code in between mirrors tag
<mirror>
<id>maven-mirror</id>
<name>Maven Mirror</name>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
It will force maven to use https://repo.maven.apache.org/maven2 url.
Using Ubuntu 16.04, java 1.8.0_201.
I un-installed old maven and installed Maven 3.6.3,
still got this error that Maven dependencies are failing with a 501 error.
Realized it could be a truststore/keystore issue associated with requiring https.
Found that you can now configure -Djavax options using a jvm.config file, see: https://maven.apache.org/configure.html.
As I am also using Tomcat I copied the keystore & truststore config from Tomcat (setenv.sh) to my jvm.config and then it worked!
There is also an option to pass the this config in 'export MAVEN_OPTS' (when using mvn generate) but although this stopped the 501 error it created another: it expected a pom file.
Creating a separate jvm.config file works perfectly, just put it in the root of your project.
Hopefully this helps someone, took me all day to figure it out!
Same issue is also occuring for jcenter.
From 13 Jan 2020 onwards, Jcenter is only available at HTTPS.
Projects getting their dependencies using the same will start facing issues. For quick fixes do the following in your build.gradle
instead of
repositories {
jcenter ()
//others
}
use this:
repositories {
jcenter { url "http://jcenter.bintray.com/"}
//others
}
The error:
Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.1/wagon-ssh-2.1.pom.
Return code is: 501 , ReasonPhrase:HTTPS Required.
Root cause analysis:
Maven central is expecting that the clients use https, but the client is making plain HTTP request only.
Therefore, the request for downloading the package named 'wagon-ssh-2.1.pom' had failed.
How to fix the problem?
Replace the URL "http://repo.maven.apache.org/maven2"
with "https://repo.maven.apache.org/maven2"
in pom.xml file or build.gradle file of the project.
My current environment does not support HTTPS, so adding the insecure version of the repo solved my problem: http://insecure.repo1.maven.org as per Sonatype
<repositories>
<repository>
<id>Central Maven repository</id>
<name>Central Maven repository insecure</name>
<url>http://insecure.repo1.maven.org</url>
</repository>
</repositories>
The following link got me out of the trouble,
https://support.sonatype.com/hc/en-us/articles/360041287334-Central-501-HTTPS-Required
You could make the changes either in your maven, apache-maven/conf/settings.xml.
Or, if you are specifying in your pom.xml, make the change there.
Before,
<repository>
<id>maven_central_repo</id>
<url>http://repo.maven.apache.org/maven2</url>
</repository>
Now,
<repository>
<id>maven_central_repo</id>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
Note the change from http to https
Sharing this in case anyone needs it:
Old Gradle config( without Gitlab , Docker deployments , for simple projects)
repositories {
google()
jcenter()
maven { url "http://dl.bintray.com/davideas/maven" }
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'http://repo1.maven.org/maven2' }
maven { url 'http://jcenter.bintray.com' }
}
New config :
repositories {
google()
jcenter()
maven { url "https://dl.bintray.com/davideas/maven" }
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://repo1.maven.org/maven2' }
maven { url 'https://jcenter.bintray.com' }
}
Notice the https. Happy coding :)
Originally from https://stackoverflow.com/a/59796324/32453 though this might be useful:
Beware that your parent pom can (re) define repositories as well, and if it has overridden central and specified http for whatever reason, you'll need to fix that (so places to fix: ~/.m2/settings.xml
AND also parent poms).
If you can't fix it in parent pom, you can override parent pom's repo's, like this, in your child pom (extracted from the 3.6.3 default super pom, seems they changed the name from repo1 as well):
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url> <!-- the https you've been looking for -->
<layout>default</layout>
<snapshots>
<enabled>false</enabled> <!-- or set to true if desired, default is false -->
</snapshots>
</repository>
</repositories>
This error occured to me too. I did what Muhammad umer said above. But, it only solved error for spring-boot-dependencies and spring-boot-dependencies has child dependencies. Now, there were 21 errors. Previously, it was 2 errors. Like this:
Non-resolvable import POM: Could not transfer artifact org.springframework.cloud:spring-cloud-dependencies:pom:Hoxton.SR3 from/to central
and also https required in the error message.
I updated the maven version from 3.2.2 to 3.6.3 and java version from 8 to 11. Now, all errors of https required are gone.
To update maven version
Download latest maven from here: download maven
Unzip and move it to /opt/maven/
Set the path export PATH=$PATH:/opt/maven/bin
And, also remove old maven from PATH
On an old grails environment the only thing that works without upgrading is:
settings.xml
<settings>
<mirrors>
<mirror>
<id>centralhttps</id>
<mirrorOf>central</mirrorOf>
<name>Maven central https</name>
<url>http://insecure.repo1.maven.org/maven2/</url>
</mirror>
</mirrors>
</settings>
I downloaded latest eclipse and tarted to use from here https://www.eclipse.org/downloads/packages/release/ which resolved my problem.
I hit this problem with the latest version (August 2020) (after not using Maven on this machine for ages) and was scratching my head as to why it could still be an issue after reading these answers.
Turns out I had an old settings.xml sitting in the .m2/ folder in my home directory with some customisations from years ago.
However, even deleting that file didn't fix it for me. I ended up deleting the entire .m2 folder.
I don't think there was anything else in it except for downloaded resources. Maybe just deleting folders like repository/org/apache/maven/archetype would have been sufficient.
I downloaded the last netbeans version 12.2, and the problem was resolved.
Add the following repository in pom.xml.
<project>
...
<repositories>
<repository>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>https://repo1.maven.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
...
</project>

Maven build error - The following artifacts could not be resolved

I want to build a spring mvc project by maven, I got the following error:
The following artifacts could not be resolved: org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0, org.hibernate:hibernate-validator:jar:4.2.0.Beta1: Could not find artifact org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0 in central (http://repo1.maven.org/maven2)
I use eclipse and m2eclipse plugin. I don't know how to add local repository. And I found for different versions of eclipse,the result is different. Some can pass, some fail. I am confused.
By the way where can I find the version of maven used in m2eclipse?
Update:Now I can handle hibernate-validator,but even I deleted all spring mvc dependencies,I found there are many other library are dependent on com.springsource.org.aopalliance,
Check your %.m2\repository\org\aopalliance\com.springsource.org.aopalliance\1.0.0\.
If there isn't a com.springsource.org.aopalliance-1.0.0.jar in there, just download it by yourself and copy it to this folder.
Since you are working with spring artifacts, you can refer to this doc. If you are working on released versions of spring, you can add the following repository in your settings.xml
<repository>
<id>com.springsource.repository.maven.release</id>
<url>http://maven.springframework.org/release/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
[Edit 1: based on the comment]
The groupId/projectId of aopalliance seems to indicate it is in spring enterprise bundle repository. The contents of this accessible from the following repository url.
<url>http://repository.springsource.com/maven/bundles/release/</url>
As for hibernate-validator, being a beta release, it is possibly not available in the normal repos. It is available from
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
The version of maven used in m2eclipse can be found in Window->Preferences->Maven->Installations
It looks like the artifact cann't be found in any repository you have defined in your settings.xml or pom file. Try adding sonatype repositories, they have artifacts you're looking for
In your pom.xml , add :
<project>
...
<repositories>
<repository>
<id>sonatype repo</id>
<url>https://repository.sonatype.org/content/repositories/central</url>
</repository>
</repositories>
...
</project>
However it's good practice to have its own repository manager (nexus, archiva, ...)
You should add the "external" repository to your pom.xml:
<repository>
<id>com.springsource.repository.bundles.external</id>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
My complete repositories tag in pom.xml is as follows:
<repositories>
<repository>
<id>com.springsource.repository.maven.release</id>
<url>http://repo.springsource.org/release/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>com.springsource.repository.bundles.release</id>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
</repositories>

java.net maven repo - JMS artifact missing

I just created a new Maven project using the default archetype and added the following dependency to my POM file.
<dependencies>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
Realizing that the Sun's JARs are not on Maven central due to licensing issues, I added
the following Maven repo to my POM (I know this is bad practice though and that it needs to be added to a settings.xml)
<repositories>
<repository>
<id>Repo ID</id>
<layout>default</layout>
<name>Java.net Maven repo</name>
<releases>
<enabled>true</enabled>
</releases>
<url>http://download.java.net/maven/2/</url>
</repository>
</repositories>
I still see this error in my POM file.
"Missing artifact javax.jms:jms:jar:1.1:compile"
Does anyone here know what else needs to be done in addition to the config I already have?
Realizing that the Sun's JARs are not on Maven central due to licensing issues, I added
the following Maven repo to my POM
Yeah, but http://download.java.net/maven/2/javax/ doesn't have the jms artifact...
The good news is that the JBoss Nexus repository does have it:
<repository>
<id>repository.jboss.org-public</id>
<name>JBoss repository</name>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
</repository>
If you just want the jms artifact and don't want to add the whole repo, you can do the following:
wget https://repository.jboss.org/nexus/content/groups/public/javax/jms/jms/1.1/jms-1.1.jar
mvn -e install:install-file -Dfile=./jms-1.1.jar -DartifactId=jms -DgroupId=javax.jms -Dversion=1.1 -Dpackaging=jar
In fact the real solution for this issue is to use the jms-api-1.1-rev-1.jar artifact available on Maven Central : http://search.maven.org/#artifactdetails%7Cjavax.jms%7Cjms-api%7C1.1-rev-1%7Cjar

Missing maven dependency using nexus setup

I am trying to build a maven project to test out some testing software - Arquillian.
I setup nexus and added the jboss repositories to the bottom of the public group.
When i run mvn test i get this error:
Missing:
----------
1) com.sun.istack:istack-commons-runtime:jar:1.1-SNAPSHOT
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.sun.istack -DartifactId=istack-commons-runtime -Dversion=1.1-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=com.sun.istack -DartifactId=istack-commons-runtime -Dversion=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.jboss.arquillian.sandbox.showcase:arquillian-sandbox-showcase-jsf:jar:1.0.0-SNAPSHOT
2) org.jboss.jbossas:jboss-as-client:pom:6.0.0.20100721-M4
3) org.jboss.jbossas:jboss-as-iiop:jar:client:6.0.0.20100721-M4
4) org.jboss.jbossts:jbossjts:jar:4.11.0.Final
5) org.jboss.ws.native:jbossws-native-core:jar:3.3.0.CR1.SP2
6) com.sun.xml.ws:jaxws-rt:jar:2.2
7) com.sun.xml.ws:policy:jar:2.0-b01
8) com.sun.istack:istack-commons-runtime:jar:1.1-SNAPSHOT
I checked the java.net maven 2 repository and it is definately there.
However when i navigate to my local nexus public group, it is not there.
How can i solve this problem? And what is the cause of this problem? I am in way over my head with this, as I am more accustomed to using ant+ivy.
The full output from mvn is here.
I had apparently the exact same problem. I solved it.
In my case, the problem was that the repository that was hosting istack-common-runtime-1.1.0-SNAPSHOT was flagged "release" in the configured nexus proxy repo. So nexus was ignoring all snapshots in that repository.
I just configured another proxy repository pointing on the same one that contains istack-common-runtime-1.1.0-SNAPSHOT, but flagging it to "SNAPSHOT" when configuring it. I then added this new proxy to my "SNAPSHOT" group.
In my settings.xml, I have a repository on the public nexus group and another on the snapshots group :
<profiles>
<profile>
<id>nexus</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>release</id>
<url>http://nexus-server/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>http://nexus-server/nexus/content/groups/public-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
Hope this help
Does it show up if you use the nexus web interface to search for it? I've seen cases in our nexus install where an artifact looks like it's missing like this, but shows up in the search results. If I then download it via my browser from the search results, it magically starts working at the maven command line.
Not the robust solution you want to hear, I'm sure, but it's at least worth a try.
If you've added the JBoss repository to Nexus, did you remember to configure your Public Repositories group to include it?
Here's a screenshot:
Are you behind a corporate firewall? Perhaps a HTTP proxy needs to be configured within Nexus (See the Server admin screen)
Ended up being a bad dependency. I had to add it manually to get it all working. Terrible!

Snapshot not downloaded by Maven

I am trying to set up Maven with a Repository located in our local Network and I already have set up a Repository for snapshots and one for Releases (both apache archiva).
Downloading the packages from the release repository works fine. However I keep getting errors, when I try to load SNAPSHOT versions from the snapshot repository, when I try to download a SNAPSHOT I deployed myself:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) my.company:product2:jar.lastUpdated:0.0.2-SNAPSHOT
Try downloading the file manually from the project website.
[...]
Path to dependency:
1) my.company:product1:war:0.0.1-SNAPSHOT
2) my.company:product2:jar.lastUpdated:0.0.2-SNAPSHOT
----------
1 required artifact is missing.
for artifact:
my.company:product1:war:0.0.1-SNAPSHOT
from the specified remote repositories:
my-internal (http://my-repo:8080/archiva/repository/internal),
central (http://repo1.maven.org/maven2),
my-snapshots (http://my-repo:8080/archiva/repository/snapshots),
The package is available in the snapshots-repo, network is up, login works fine.
My pom.xml looks like this:
[...]
<repositories>
<repository>
<id>my-snapshots</id>
<name>my name Snapshots Repository</name>
<url>http://my-snapshots:8080/archiva/repository/snapshots</url>
<snapshots>
<enabled/>
<updatePolicy/>
<checksumPolicy/>
</snapshots>
</repository>
<repository>
<id>my-internal</id>
<name>my name internal Repository</name>
<url>http://my-repo:8080/archiva/repository/internal</url>
</repository>
</repositories>
[...]
<dependency>
<groupId>my.company</groupId>
<artifactId>frontend-api</artifactId>
<version>0.0.2-SNAPSHOT</version>
<type>jar.lastUpdated</type>
</dependency>
[...]
I checked also the maven-metadata.xml that was downloaded from the snapshot-repo:
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>my.company</groupId>
<artifactId>product2</artifactId>
<version>0.0.2-SNAPSHOT</version>
<versioning>
<snapshot>
<buildNumber>7</buildNumber>
<timestamp>20090824.130209</timestamp>
</snapshot>
<lastUpdated>20090824130209</lastUpdated>
</versioning>
</metadata>
It shows the correct date and timestamp (a package containing this timestamp is present in the repo).
Am I missing something concerning the repository setup or the SNAPSHOT concept? Did anybody had the same problem? Or does somebody know about some detailed documentation about SNAPSHOTs and Repositories?
What does the dependency declaration for my-app look like? I'd expect it to look like this:
<dependency>
<groupId>my.company</groupId>
<artifactId>product2</artifactId>
<version>0.0.2-SNAPSHOT</version>
</dependency>
From the error, it looks like it has been generated by an archetype and added the lastUpdated type. If that is the case removing lastUpdated should resolve the issue.
If that's not the case, can you share the section of your POM please?
For more information on Maven SNAPSHOT versions, see the Maven book:
Maven versions can contain a string literal to signify that a project is currently under active development. If a version contains the string “SNAPSHOT,” then Maven will expand this token to a date and time value converted to UTC (Coordinated Universal Time) when you install or release this component. For example, if your project has a version of “1.0-SNAPSHOT” and you deploy this project’s artifacts to a Maven repository, Maven would expand this version to “1.0-20080207-230803-1” if you were to deploy a release at 11:08 PM on February 7th, 2008 UTC. In other words, when you deploy a snapshot, you are not making a release of a software component; you are releasing a snapshot of a component at a specific time.
The lastUpdated property is therefore not typically needed.
Run the mvn with the -e flag for more detailed error messages.
What about your settings.xml file?
if your pom xml has the following:
<repositories>
<repository>
<id>my-snapshots</id>
<name>my name Snapshots Repository</name>
<url>http://my-snapshots:8080/archiva/repository/snapshots</url>
<snapshots>
<enabled/>
<updatePolicy/>
<checksumPolicy/>
</snapshots>
</repository>
then the setting.xml should have something like:
<server>
<id>my-snapshots</id>
<username>user</username>
<password>pass</password>
<privateKey>${user.home}/.ssh/id_dsa</privateKey>
<passphrase>some_passphrase</passphrase>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
1) The repository username and password must be as above
2) The id tag in both settings and pom must be the same:
<id>my-snapshots</id>