i have a big problem since this morning. prefix that i already checked if this problem was solved but , tought ther are simylar problem, my error persist.
the problem is that when i'm trying to add a new dependency in the project pom ,maven can't download and says "could't solve artifact .." , in the m2 repository, for example imagine that i'm trying to add postgresql dependency, in the postgresql folder there are only lastUpdated file . i know it means that maven create this file because it can't download it and they "remember" that but, why?? i tryed everything from other similar post, like build clean install -U , or deletting from cmd all .lastUpdated file or cleaning the workspace and create a new one but unsolved my problem. the funny thing is that when i change the project in another eclipse workspace (and the settings associated to them) it goes. my friend have the same configuration (settings ecc) of the project and he doesn't have this problem, so i think isn't a problem of settings.
have you got some advice for me? i not posting any code but if you need something i will do.
thanks
This case had troubled me for a while, just add a repository in your project pom.xml. And this can solve my problen bellow, have a try and good luck~
<repositories>
<repository>
<id>maven2-release</id>
<url>http://uk.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>oss-snapshots</id>
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
I have that problem sometimes, especially in the work network.
I have 2 variants which help me to solve that problem:
1)Just go with your Terminal into the directory and run "mvn compile". Then it should work.
If not you can try to Invalidate the Caches and Restart IntelliJ:
File->Invalidate Caches & Restart"
2)If you also use Idea, you can change maven version from its on yours. In my case, I changed from maven3 to maven, which I have on C:\maven. After that, all dependencies would be downloaded
Maven is more of a convenience that saves you from needing to go out to the world wide net, and manually download all the jar files. It isn't always perfect.
I recommend that you manually look up and download the jar file you need on the interweb.
Then, use this format at the command line to manually add it to your Maven repository:
mvn install:install-file -DgroupId=javax.example -DartifactId=example -Dversion=1.0.0 -Dpackaging=jar -Dfile=jta-1.0.1.jar
(above was just an example and you will need to look up the specifics for your jar file. )
Related
ERROR:
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Solutions Tried:
Updated project: not able to download from REPO of maven.
Tried putting perticular jar in that folder of .m2 repo.
Can provide references if you want.
Seems your settings.xml file is missing your .m2 (local maven repo) folder.
When using eclipse navigate to Window -> Preferences -> Maven -> User Settings -> Browse to your settings.xml and click apply.
Then do maven Update Project.
Right Click on Project go to -> Maven -> Update project ->select Force update project check box and click on Finish.
On windows:
Remove folder from C:\Users\USER.m2
Close and open the project or force a change on file: pom.xml for saving :)
If a download fails for some reason Maven will not try to download it within a certain time frame (it leaves a file with a timestamp).
To fix this you can either
Clear (parts of) your .m2 repo
Run maven with -U to force an update
I have faced the same issue. Try declaring missing plugin in the conf/settings.xml.
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Step 1 : Check the proxy configured in eclipse is correct or not ?
(Window->Preferences->General->Network Connections).
Step 2 : Right Click on Project-> Go to Maven -> Update the project
Step 3: Run as Maven Install.
==== By Following these steps, i am able to solve this error.
This fixed the same issue for me:
My eclipse is installed in /usr/local/bin/eclipse
1) Changed permission for eclipse from root to owner: sudo chown -R $USER eclipse
2) Right click on project/Maven right click on Update Maven select Force update maven project
I had exactly the same error. My network is an internal one of a company. The proxy has been disabled from the IT team so for that we do not have to enable any proxy settings. I have commented the proxy setting in settings.xml file from the below mentioned locations C:\Users\vijay.singh.m2\settings.xml
This fixed the same issue for me
This issue is happening due to change of protocol from http to https for central repository. please refer following link for more details. https://support.sonatype.com/hc/en-us/articles/360041287334-Central-501-HTTPS-Required
In order to fix the problem, copy following into your pom.ml file. This will set the repository url to use https.
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</pluginRepository>
</pluginRepositories>
I had exactly the same error. My network is an internal one of a company. I downloaded neon-eclipse for java developpers. These steps worked for me:
1- I downloaded a VPN client on my PC to be totally blinded from the network. Shellfire I used. Use free account and connect to Shellserver.
2- Inside the windows firewall, I added incoming rule for Eclipse. Navigate to where eclipse exe is found.
3- Perform Maven Update project.
Then the project was able to fetch from the maven repository.
hope it helps.
Tried everything. I deleted m2e and installed m2e version 2.7.0. Then deleted the .m2 directory and force updated maven. It worked!
Right click on your project under Package Explorer > Maven > Update Project > Select the checkbox that reads "Force updates of Snapshot/Releases" > Click on OK
This way you don't have to search around for your maven's settings.xml and if the cause is something else eclipse will automatically handle it whatever it may be. Expected path for user settings XML is shown by eclipse under: Window > Preferences > Maven > User Settings > User Settings (it is most likely, greyed out).
What worked for me was:
mvn -Dhttps.protocols=TLSv1.2 install
I faced the same issue and resolved by deleting the project that i created and then deleted the M2 folder in the local.
If you're connected to VPN, disconnect and then try.
When I run an integration test for my project, it is trying to search in a repo that is being pulled transitively and I need to wait for time out. I blacklisted that repo like this.
<repository>
<id>seacrh-snapshots</id>
<name>Exodus Snapshot Repository</name>
<url>http://repo URL/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
but it is still pulling this repo when I run the IT test:
Downloading: URL repo/maven-metadata.xml
Is there anything else that need to be changed?
I strongly recommend to use a Maven Repository Manager such as Nexus. It will help you to get stable and reproducible builds with Maven. You can disable Repositories there (or Nexus can handle this for you as well).
http://www.sonatype.com/books/nexus-book/reference/maven-sect-single-group.html
http://maven.apache.org/repository-management.html
Normally, when maven runs it goes to fetch artifacts in the following order
it check your local .m2/repositories folder
if it can't find the artifact then it reads your pom / parent pom/ super Pom / user level setting.xml/ global setting.xml - in that order to find external repositories to download the artifacts from, usually these repo are either directly from the internet (like the pre-configured default maven repositories) or local private repo managers(like nexus, Artifactory).
Maven will execute the repo as in the order in which they are declared.
First of all, check your project effective-pom that nothing else is overriding your configuration. either in the terminal by typing mvn help:effective-pom on the project root dir or easily in eclipse "effective pom" view of your pom.
Otherwise, it's a good use-case for you to consider installing local repository manager as you would not always need to fetch externally your third party dependencies everytime you run maven.
i would recommend Artifactory much better than the nexus.
I'm new to almost all related things, but would like to build a Java Web Start application using Maven. I also need to repack a specific .jar (commons-httpclient-3.1.jar), or it won't sign with JarSigner (looks to be a common problem when I googled). Perhaps I could use this Maven plugin, but I don't even know how to setup the Maven repository.
I (might) need to:
set up the Maven repository to be able to use the above plugin,
configure the jnlp build using the plugin,
take use of three .jars that we have developed (already built using Maven) and install along with the dependencies (such as slf4j-api-1.6.1.jar, spring-security-core-3.0.7.RELEASE.jar and a dozen or so others),
also unpack and repack a specific .jar (repack using jar.exe, not zip since it doesn't work).
I much prefer examples to links to big chunks of documentation. :) Thanks in advance!
you can use a maven plugin for web start
Alternatively you can generate a war with the jnlp file inside (created manually)
You can even create a servlet that will create a jnlp (with stuff like get all jars in some lib directory) and return dynamically to the client.
The plugin should be in the maven repository, but I've never checked it...
You've probably figured this out by now, but plugin repositories are referenced with a separate configuration in your pom to the normal installation repositories.
e.g.
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
See here http://maven.apache.org/guides/introduction/introduction-to-the-pom.html
I believe there's a maven command you can execute to download and install a plugin in the local repository. Something like:
mvn plugin:download -DartifactId=maven-war-plugin
-DgroupId=org.apache.maven.plugins -Dversion=2.1.1
-Dmaven.repo.remote=http://www.ibiblio.org/maven,http://maven-plugins.sourceforge.net/repository
I know that this should normally happen when you build a project whose pom.xml references this plugin, but the security policy where I work is abnormal, so I need to manually install plugins.
The syntax above doesn't seem to work, does anyone know how to do this under Maven 3.0.2?
The above syntax is for Maven 1.0, which operated very differently from Maven 2.0 and Maven 3.0. You should continue to reference the plugin as you would - via the POM in this case or via the command-line directly for some types of commands. To strictly control what artifacts get downloaded, you can use a repository manager (such as Apache Archiva, Artifactory or Nexus) to intervene (as well as add several interesting features).
Here is how to force Maven to use the managed repository instead: http://archiva.apache.org/docs/1.3.4/userguide/using-repository.html
You can either add only the artifacts you want to use to that, or configure rules about what can be retrieved externally (e.g. http://archiva.apache.org/docs/1.3.4/adminguide/proxy-connectors.html)
The optimal way to deal with plugin and other artifact installation is to implement an instance of a Maven repository on your LAN. Products such as Nexus are open-source and easy to set up. Once up and running, upload your Plugin manually to Nexus. Then add your own local Nexus instance as a plugin repository inside of the settings.xml file for the developers who need it:
<pluginRepositories>
<pluginRepository>
<id>mycorp-plugin-release</id>
<name>My Companys Nexus repository for plugin artifact releases</name>
<url>https://intranet.mycorp.com/nexus/content/repositories/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
Seriously...it'll take a day to set up initially, but will make your life easier and shouldn't violate ANY security policy. It'll also help to ensure that all developers are using the exact same version of the plugin.
I'm working on a fairly big Maven project. We have probably around 70 or so individual artifacts, which are roughly split into two libraries of shared code and maybe ten applications which use them. All of these items live in the namespace com.mycompany.*.
Most of the time we're running against snapshot builds. So to do a full build of an application, I might first build the library projects so that they are installed to my local repository (as, say, mycompany-libname-2.4-SNAPSHOT.jar).
The problem is that when I then go build the applications. For some reason, Maven wants to check the main two public repositories (maven-net-repo and java-net-repo) for updates for all of the mycompany-*-SNAPSHOT.jar artifacts. Of course, they aren't found there, and everything eventually resolves back to the versions I just built to my local repository, but I'd like Maven to stop doing this because (a) it makes me feel like a bad net.citizen for constantly checking these repositories for things that will never be there, and (b) it adds some unnecessary and annoying network latency into my build process.
I've taken to running maven in offline mode most of the time to work around this, but that's not ideal since occasionally a dependency on a public library will be updated. So what I'm looking for is a solution which will cause Maven not to check for updates from given repositories for artifacts which meet certain criteria - in this case, I'd be happy if Maven would ignore either SNAPSHOT versions or artifacts which were in the com.mycompany namespace.
Also, you can use -o or --offline in the mvn command line which will put maven in "offline mode" so it won't check for updates. You'll get some warning about not being able to get dependencies not already in your local repo, but no big deal.
Something that is now available in maven as well is
mvn goal --no-snapshot-updates
or in short
mvn goal -nsu
The updatePolicy tag didn't work for me. However Rich Seller mentioned that snapshots should be disabled anyways so I looked further and noticed that the extra repository that I added to my settings.xml was causing the problem actually. Adding the snapshots section to this repository in my settings.xml did the trick!
<repository>
<id>jboss</id>
<name>JBoss Repository</name>
<url>http://repository.jboss.com/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
Update: I should have probably started with this as your projects are SNAPSHOTs. It is part of the SNAPSHOT semantics that Maven will check for updates on each build. Being a SNAPSHOT means that it is volatile and subject to change so updates should be checked for. However it's worth pointing out that the Maven super POM configures central to have snapshots disabled, so Maven shouldn't ever check for updates for SNAPSHOTs on central unless you've overridden that in your own pom/settings.
You can configure Maven to use a mirror for the central repository, this will redirect all requests that would normally go to central to your internal repository.
In your settings.xml you would add something like this to set your internal repository as as mirror for central:
<mirrors>
<mirror>
<id>ibiblio.org</id>
<name>ibiblio Mirror of http://repo1.maven.org/maven2/</name>
<url>http://path/to/my/repository</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
If you are using a repository manager like Nexus for your internal repository. You can set up a proxy repository for proxy central, so any requests that would normally go to Central are instead sent to your proxy repository (or a repository group containing the proxy), and subsequent requests are cached in the internal repository manager. You can even set the proxy cache timeout to -1, so it will never request for contents from central that are already on the proxy repository.
A more basic solution if you are only working with local repositories is to set the updatePolicy for the central repository to "never", this means Maven will only ever check for artifacts that aren't already in the local repository. This can then be overridden at the command line when needed by using the -U switch to force Maven to check for updates.
You would configure the repository (in your pom or a profile in the settings.xml) as follows:
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
<updatePolicy>never</updatePolicy>
</repository>
Very simple :
In your Super POM parent or setting.xml, use
<repository>
<id>central</id>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<updatePolicy>never</updatePolicy>
</snapshots>
<url>http://repo1.maven.org/maven2</url>
<layout>legacy</layout>
</repository>
It's my tips
I had some trouble similar to this,
<repository>
<id>java.net</id>
<url>https://maven-repository.dev.java.net/nonav/repository</url>
<layout>legacy</layout>
</repository>
<repository>
<id>java.net2</id>
<url>https://maven2-repository.dev.java.net/nonav/repository</url>
</repository>
Setting the updatePolicy to "never" did not work. Removing these repo was the way I solved it.
ps: I was following this tutorial about web services (btw, probably the best tutorial for ws for java)