Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:2.3.2 or one of its dependencies could not be resolved - maven

I got the following error message when I tried to create a Maven project in eclipse. Many have posted about proxies in settings.xml file and also flush the .m2 folder forcing it to download a new one. None of this is working for me. I'm at work, with proxy settings active in the internet options.
The error message:
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
POM.XML:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.blahhhhhhhhhhhhhhhhh</groupId>
<artifactId>HelloRESTEasy</artifactId>
<version>0.0.1-SNAPSHOT</version>
</project>
settings.xml:
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxyserver.company.com</host>
<port>8080</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>

Try cleaning the local .m2/repository/ folder manually using rm -rf and then re build the project. Worked for me after trying every possible other alternative(reinstalling eclipse, pointing to the correct maven version in eclipse, proxy settings etc)

I was able to solve the same problem with different solution.
The solution that worked for me was to Right click project "pom.xml" in eclipse and select "Maven Install".

I solved it now. However it only is solved in Netbeans. Not sure why eclipse still won't take the settings.xml that is changed. The solution is however to remove/comment the User/Password param in settings.xml
Before:
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxyserver.company.com</host>
<port>8080</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
After:
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<host>proxyserver.company.com</host>
<port>8080</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>

Mainly this occurs during Eclipse upgrade.
I Solved using:
-> Right Click Project-> Maven->Update Project-> Select all (checkbox)
Old or out-dated, projects got refreshed with the updated jar files, and the required plugins. No more errors were visible.

For me, this problem occurs in Eclipse when the Maven installation is not well configured. By default the Maven installation is embedded in Eclipse. The .settings.xml file is set wherever the Eclipse installation points.
In my case this file was not auto-generated. I choose my own Maven installation - an external one. But if you don't explicitly choose where settings.xml is then Eclipse tries to get this file from the path set in the embedded installation. If the file is not autogenerated you have to choose the correct location.
Go to windows/preferences/Maven/Installation/user settings and choose the correct location of your settings.xml.

I also faced the above error. I used Eclipse.
After followed the below solution, it works fine for me.
Solution is,
Right click project "pom.xml" in eclipse and select Maven Install.
Right click on the project -> Maven -> Update Project.
Refresh

Right click project "pom.xml" in eclipse and select Maven Install.
Right click on the Project -> Maven -> Update Project.
Then Refresh.

I have had this issue and I resolved it by following the next step:
1- Close Eclipse.
2- Go to user directory and delete the .m2 directory.
3- Open Elipse.
4- Right click on the project -> Run as -> maven install

I have had this issue, and removing the .m2/repository/ has not solved it in my case. Seems that eclipse is unable to download the maven-plugin or dependency needed. Therefore you need to install it yourself.
I have finally solved it downloading both jar and pom files from the Maven Repository and installing it using the command (better than copying to the folder directly):
mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>
(In my case: mvn install:install-file -Dfile=maven-war-plugin-2.2.pom -DpomFile=maven-war-plugin-2.2.pom)

In my case the error was: CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 ....
With eclipse luna from console in the pom.xml folder
mvn clean
mvn install
With Juno I had to had this to my pom.xml
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<!-- put your configurations here -->
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
And then
mvn install
And then from eclipse right click>maven>update project
* Once the plugin is donwloaded you can remove the plugin from your pom.xml

Jotting down some steps which help:
Writing answer from eclipse perspective as base logic will remain the same whether done by Intellij or command line
Rt click your project -> Maven -> Update project -> Select Force update -> Click OK
Under properties tag , add :
> <maven.compiler.source>1.8</maven.compiler.source>
> <maven.compiler.target>1.8</maven.compiler.target>
In some instance , you will start seeing error as we tried force update , saying , failure to transfer X dependency from Y path , resolutions will not be reattempted , bla bla bla
**In such case quickly fix it by cd to .m2/repository folder and run following command :
for /r %i in (*.lastUpdated) do del %i**

I also had the same problem. I used next way:
1.Added settings.xml file (~/.m2/settings.xml) with next content
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>qq-proxya</host>
<port>8080</port>
<username>user</username>
<password>passw</password>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
3. Using cmd go to folder with my project and wrote mvn clean and after that mvn install !
After that updated project in the Eclipse(Alt + F5) or right click on project -> Maven -> Update project
P.S. after that, when I add new dependency to my project I have to compile project using cmd(mvn compile). Because if I do it using eclipse plugin, I get error connecting with proxy connection.

I had this error, I follwed below three steps to solve,
1). check proxy settings in settings.xml refer,
2). .m2 diretory to release cached files causing problems
3) Point your eclipse to correct JDK installation.
Refer No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? to know how

I also faced same problem... I follow the following steps...u can try it
1. Right click on maven project
2. Take cursor in Maven
3. Click on Update Maven project or (alt+F5).
it will take some time then most probably problem will solved..

There could be multiple reasons, i fixed with following steps:
delete .m2 folder and re launch eclipse. (Find m2 folder in
windows: c:\Users\Your_User_Name\ .m2
or to search in Mac : ~/.m2
make sure settings.xml is configured as #JustinBieber mentioned.
provide settings.xml path in eclipse (windows->preferences->maven->user settings) User Settings must locate settings.xml file.
save changes and relaunch the eclipse..!! it should work.

Excellent i got solution:
Just clearing (.m2) complete folder and starting a new maven project problem solved for me.
Note:: .m2 folder located in os installed disk only.
If you want the exact location, check in Eclipse:
Eclipse-->window-->preferences-->maven-->user settings
There local repository path is for .m2
Delete entire .m2 folder and restart your eclipse.

I had same issue while creating new spring project in eclipse using Maven.
The main reason for this issue is that the proxy settings was not there.
I used the following approach to reslove it:
1) create settings.xml with the below content
<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/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers/>
<mirrors/>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>Your proxy</host>
<port>Your port</port>
</proxy>
</proxies>
<profiles/>
<activeProfiles/>
</settings>
2) Save the settings.xml file under local C:\Users\<<your user account>>\.m2
3) Then Right click project pom.XML in eclipse and select "Update Project". It always give precedence to settings.XML

I have summarised what I did for my issue.
1) Delete .m2 folder.
2) Change the apache-maven-3.5.4\conf\settings.xml as follow
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<host>proxyserver.company.com</host> --> Please change it according to your proxy
<port>8080</port> -->Please change it accordingly
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
3) Try again in cmd. It will work.
4) For eclipse, delete the existing maven project and go to
window ->prefernces -> maven -> user settings -> browse -> configure this path apache-maven-3.5.4\conf\settings.xml
5) Delete .m2 folder.
6) Restart the eclipse and try creating new maven project.
These steps worked for me.

Maybe your network is slow, so that jar isn't downloaded completely.
There are two methods:
a. find your .m2 folder, you can find some path like this 'org/apache/maven/plugins/maven-resources-plugin', you need only delete this foldler 'maven-resources-plugin', because others are downloaded well.
Then maven build your project.
If other problem occures, repeat this process again.
b. you can change a more quick maven source.
Firstly, you should find maven's settings file(window ->prefernces -> maven -> user settings). If it is empty, you can create a new one (any path, for example, .m2/settings).
Secondly, add sth like this (From https://blog.csdn.net/liangyihuai/article/details/57406870). This example uses aliyun's maven.
<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">
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
Thirdly, maven build again. (before this, you should delete your .m2 folder's files)

Force update works for me.
Select the force update option as per image in update maven project.

run:
mvn -U dependency:go-offline
It works for me.

Related

How to solve :Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 [duplicate]

org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
at org.eclipse.m2e.core.internal.project.registry.EclipsePluginDependenciesResolver.resolve(EclipsePluginDependenciesResolver.java:48)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:152)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.setupMojoExecution(MavenImpl.java:386)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.setupMojoExecution(ProjectRegistryManager.java:865)
at org.eclipse.m2e.core.internal.project.registry.MavenProjectFacade.getMojoExecution(MavenProjectFacade.java:355)
at org.eclipse.m2e.core.project.configurator.AbstractCustomizableLifecycleMapping.getBuildParticipants(AbstractCustomizableLifecycleMapping.java:66)
at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:87)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:414)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:351)
at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:74)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:279)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:115)
I have read where many people were able to solve this by:
Deleting the folder from the local repository and letting it re-download it (this did not work)
By configuring eclipse to target your maven installation instead of the embedded one as described here (this did not work)
Could not calculate build plan :artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 is not available in the local repository
I am new to Maven so please excuse any of my ignorance.
This project is working on another machine, and just pulled it down from the repository on this one, with the same version of eclipse and m2e plugin installed. I have been fooling with this for over 10 hours now and it is driving me nuts (Maven has been nothing but headaches for me so far...)
EDITS
After looking closer I did notice that it is not downloading the .jar files into the local repository... I am not sure if that is something obvious...
I am not given the option to add Maven Dependencies to the build path.
I had the exact same problem.
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Failure to find org.apache.maven.plugins:maven-resources-plugin:pom:2.5 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
...
Had maven 3.0.5, eclipse Kepler with JBoss Dev Studio 7 installed. Computer sitting on internal network with proxy to the internet. Here's what I did.
0. Check the maven repositiory server is up
1. Check Proxy is set up and working
First I thought it was a proxy problem, I made sure that maven settings.xml contained the proxy settings (settings.xml can exist in two places one in MAVEN_HOME. The other in %userprofile%.m2\ with the later having higher precedence):
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>optional-proxyuser</username>
<password>optional-proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
and checked that the proxy is working by trying to telnet to it:
telnet [proxy] [port number]
2. Check not Eclipse Issue
ran 'mvn compile' at command line level outside of eclipse - same issue.
If 'mvn compile' worked. But it doesn't work using the maven plugin in eclipse, see Maven plugin not using eclipse's proxy settings
3. Check not Cache Issue
Deleted all contents in my local maven repository. (Default location: ~/.m2/repository) And then reran maven - same issue came up.
4. What worked for me
Automatically download & install missing plugin:
By declaring the missing plugin in the POM file build section for pluginManagement Maven will automatically retrieve the required plugin. In the POM file, add this code for the version of the plugin you require:
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Manually install missing plugin:
I went to http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5 and downloaded maven-resources-plugin-2.5.jar and maven-resources-plugin-2.5.pom . Copied it directly into the maven repository into the correct folder ( ~/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.5) and reran 'mvn compile'. This solved the problem.
Edit1
Following this I had another two problem with 'mvn install':
The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10 is missing, no dependency information available
The POM for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1 is missing, no dependency information available
I approached this problem the same way as above, downloading from http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin/2.10 and http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin/2.3.1
I had the exact same problem and since I read somewhere that the error was caused by a cached file, I fixed it by deleting all the files under the .m2 repository folder.
The next time I built the project I had to download all the dependencies again but it was worth it - 0 errors!!
Couple of things to try:
Doublecheck the location of the local artifact repo configured in your settings.xml file (at the following location {your home folder}/.m2/settings.xml). Are you sure the local repo is where you think it is? (Yes, a mistake I've made in the past...)
Remove entire contents of artifact repo on the new build machine (or at least anything related to Maven). You mentioned doing some artifact repo cleanup but I'm not sure what directory(ies) you removed. I've run into weird issues like these when a jar was corrupted.
Make sure you have enough disk space/quota for the local artifact repo. I have run into weird issues when I didn't have a large enough quota to hold all the artifacts, likely caused by partially downloaded jar files.
Try running with plain Maven on the command line; take Eclipse and m2e out of the equation. mvn -U dependency:resolve should do it. The -U forces Maven to download no matter what your repository update policies are. Add -X to get detailed debug logging.
Copy settings.xml from MAVEN_HOME\conf\ to USER_HOME.m2. Add proxies (if needed) in case you are behind a proxy server.
Follow easy steps to resolved the below issue:
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact description for org.apache.maven.plugins:maven-ar-plugin:ar:2.4 in eclipse
Solution:
Step1:
Step2:
Issue solved ☺
i faced the same issue while using eclipse kepler and maven version 3.2,
while building the project, it showed me the same error in eclipse
there are two versions (2.5 and 2.6) of plugin under
.m2/repository/org/apache/maven/plugins/maven-resources-plugin/
i removed 2.5 version then it worked for me
My problem was the location of the config file.
In eclipse settings (Windows->preferences->maven->User Settings) the default config file for maven points to C:\users\*yourUser*\.m2\settings.xml. If you unzip maven and install it in a folder of your choice the file will be inside *yourMavenInstallDir*/conf/, thus probably not where eclipse thinks (mine was not). If this is the case maven won't load correctly. You just need to set the "User Settings" path to point to the right file.
It appears that there can be a lot of different causes for this issue. I experienced it after installing a new version of Eclipse (Luna). Command-line maven worked fine, but Eclipse had build issues.
I use a Certificate Authority in my JRE. This is important because this provides my authentication when downloading Maven resources. Even though my project was pointing to the appropriate JRE inside of Eclipse - Eclipse was running using a different JRE (this is apparent looking at the Java process properties in Windows task manager). My solution was to add the following in my eclipse.ini
and explicitly define the JRE I want to use.
-vm
C:\Program Files\Java\jdk1.7.0_51\bin\javaw.exe
You should check Force Update Snapshots/Releases when updating project with maven.It worked for me :-).
Try to delete all dirs in /usr/share/maven-repo - of course then maven will die so you must re-install and try again. In my case re-install from maven ver.3. to maven2 with deleting all repositories helped.
I tried by deleting all from .m2 but that didn't help.
Some files where missing at your local repository. Usually under ${user.home}/.m2/repository/
Neets answer solves the problem. However if you dont want do download all the dependencies to your local repository again you could add the missing dependency to a project of yours and compile it.
Use the maven repository website to find the dependency.
In your case http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5 was missing.
Copy the listed XML to the pom.xml file of your project. In this case
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
</dependency>
Run mvn compile in the root folder of the pom.xml. Maven will download all missing dependencies. After the download you can remove the added dependency.
Now you should be able to import the maven project or update the project without the error.
What I found out is that while m2e is looking for v2.5 by default, my local repo has 2.6 and no 2.5.
Without going into investigation of how this came about
simply adding the dependency to pom solved the problem
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</dependency>
This can be removed after running a build once
his 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>
A more subtle reason for this could be a Settings.xml file which has a space in the first line before the doctype
Hopefully I'm not late for the party.
Encountered this using Eclipse Kepler and Maven 3.1.
The solution is to use a JDK and not a JRE for your Eclipse project. Make sure to try maven clean and test from eclipse just to download missing jars.
I had the same problem but with an other cause. The solution was to deactivate Avira Browser Protection (in german Browser-Schutz). I took the solusion from m2e cannot transfer metadata from nexus, but maven command line can. It can be activated again ones maven has the needed plugin.
Most people will tell you to check your proxy settings or delete and re-add artifacts, but I will stay away from that and give another suggestion in case that doesn't turn out to be your problem. It could be your mirror settings.
If you use maven at the office then there's a good chance maven is configured to look for your company's internal maven repository. If you're doing some work from home and you are not connected to the network this could be the problem. An obvious solution might be VPN to the office to get visibility to this repo. Another way around this is to add another mirror site to your /User/.m2/settings.xml file so if it fails to find it on your office network it will try public repo.
<mirror>
<id>Central</id>
<url>http://repo1.maven.org/maven2</url>
<mirrorOf>central</mirrorOf>
<!-- United States, St. Louis-->
</mirror>
For other maven repositories take a look here: http://docs.codehaus.org/display/MAVENUSER/Mirrors+Repositories
In my case I'm using an external maven installation with m2e. I've added my proxy settings to the external maven installation's settings.xml file. These settings haven't been used by m2e even after I've set the external maven installation as default maven installation.
To solve the problem I've configured the global maven settings file within eclipse to be the settings.xml file from my external maven installation.
Now eclipse can download the required artifacts.
After entering your proxy settings in settings.xml
<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
| -->
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>DOMAIN\YOURID</username>
<password>123456</password>
<host>proxy.company.com</host>
<port>8080</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
Check whether the below tag is having the value false in settings.xml
<offline>false</offline>
This helped me.
In addition to what #JackDev replies, what also solved my problem was to
1) Install the jdk under directory with no spaces:
C:/Java
Instead of
C:/Program Files/Java
This is a known issue in Windows. I fixed JAVA_HOME as well
2) Install maven as in Java case, under C:/Maven. Fixed the M2_HOME accordingly.
3) I java 7 and java 8 on my laptop. So I defined the jvm using eclipse.ini. This is not a mandatory step if you don't have -vm entry in your eclipse.ini. I updated:
C:/Java/jdk1.7.0_79/jre/bin/javaw.exe
Instead of:
C:/Java/jdk1.7.0_79/bin/javaw.exe
Good luck
If you've configured a repository in your maven's settings.xml, check if you've access to it.
When I had this problem, there were enterprise repositories configured in settings.xml but I was out of the company.
JackDev's option 3 works for me after I changed the default repository to another folder.
Below is what I see after M2E plugin automatically download the maven-resources-plugin-2.6. Maybe this could give you some hint if you want to take the manual approach. The necessary files can be downloaded from here: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/
If you have a proxy, you also have to clear SOCKS in
Window > Preferences > Network Connections.
I was getting the same issue.
I just installed the m2e (Maven2Eclipse)plugin from below site:
http://www.eclipse.org/m2e/
Eclipse>Help>Install New Software>Available Software Sites>Add
Name: m2e (any name is OK)
Location:m2e - http://download.eclipse.org/technology/m2e/releases/
Under Install Window> Work with:
Select this new location and Add all the plugins that appear. Eclipse restart and it was running properly with no previous errors.
If your working at a company, they may be preventing you from downloading outside software and installing it. You may need to install the plugins manually or repoint to an internal mirror repository.
Try downloading a different version of maven.
I had the same problem with maven 3.5.2 , I solved my problem just downloading maven 3.0.4
Very old stuff.
Got it solved fixing the localRepository in settings.xml.
This file was copied from my other computer and the path of the .m2 repository wasn't the same.
<?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:\Users\foo\.m2</localRepository>
</settings>
I could solve the issue with the following steps
Install Maven separately
https://www.mkyong.com/maven/how-to-install-maven-in-windows/
Set the external Maven installation in Eclipse
3. Set the proxy in settings.xml in Maven installation
(C:\path\apache-maven-3.6.0\conf)
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>optional-proxyuser</username>
<password>optional-proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
Update the Maven User Settings
Update Maven project
I have shifted my project to a different machine, copied all my maven libraries from old machine to new machine, did Right click on my project >> Maven >> Update Project. And then built my project. In addition to this, I have also done this one step which is shown in screenshot. And that's all it worked!!
Go to Window --> Preferences --> Maven --> User Setting, make sure you have these settings..
Also Right click on your project --> Properties --> Maven, and make sure you have the path here to maven repository..
I am facing the same issue and none of above works, like by updating the MVN also same error, by building is also same, entered details in settings.xml though even same issue.
After that again I tried and did something different which did not did before and it works.
Its simple, I clicked the force update while updating the Mvn project.
By right clicking on the pom file, there is option under Maven,
"Update Project" and it open up one popup to select update option.
PLEASE MAKE SURE FORCE UPDATE IS CHECKED, by default is unchecked. And
bingo, that works like charm!
To solve this issue I tried below method :
(I was working on eclipse IDE)
Go to location : C:\User\local.m2\setting.xml
Open setting.xml file in any editor.
Comment the proxy setting like I did(see below setting.xml file).
Then go to eclipse & perform Maven Update from :right clicking on your solution folder(Your Project)->select Maven->Update Project.
Hope it will work for you as like me.
<?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">
<!--
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
-->
</settings>

Maven Archetype generate proxy issue, searching for remote catalog

Maven seem to be having a bug related to proxy when fetching archetype from maven's remote catalog.
My computer is behind a proxy server. I am trying to generate a project from maven command line.
D:\test>mvn archetype:generate -DarchetypeArtifactId=scala-archetype-simple -DinteractiveMode=false -DgroupId=com.sparktest -DartifactId=myspark -DarchetypeGroupId=net.alchim31.maven -DarchetypeVersion=1.6 -DarchetypeCatalog=remote -e -X
[DEBUG] Searching for remote catalog: http://repo.maven.apache.org/maven2/archetype-catalog.xml
[DEBUG] Archetype org.apache.maven.archetypes:scala-archetype-simple:1.6 doesn't exist
org.apache.maven.archetype.downloader.DownloadNotFoundException:
Requested org.apache.maven.archetypes:scala-archetype-simple:jar:1.6 download does not exist.
Below Eclipse Bugs are related, however the issue seems to be with maven rather than Eclipse.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=390183#add_comment
Please note there is no issue working on existing maven project. The dependencies get downloaded without any issue once maven proxy is configured in settings.xml. The issue comes when generating a project using archetype:generate and using maven remote archetype-catalog.
Maven archetype-catelog can be opened in a browser without any issue
http://repo.maven.apache.org/maven2/archetype-catalog.xml
It's seems that scala-archetype-simple archetype with groupId org.apache.maven.archetypes doesn't actually exist.
You should try one of these :
net.alchim31.maven
org.scala-tools.archetypes
I had this exact issue and the following worked for me: have two proxies, one for http and one for https.
<proxy>
<id>my-proxy-http</id>
<active>true</active>
<protocol>http</protocol>
<host>xx.xx.x.xxx</host>
<port>8080</port>
<username>myusername</username>
<password>mypassword</password>
</proxy>
<proxy>
<id>my-proxy-https</id>
<active>true</active>
<protocol>https</protocol>
<host>xx.xx.x.xxx</host>
<port>8080</port>
<username>myusername</username>
<password>mypassword</password>
</proxy>

How to move maven directory ".m2" from my home directory after installing IntelliJ

I've just installed IntelliJ 15 on Ubuntu and wanted to update maven repository indices, I am having disk space errors because my home folder is on a limited size partition.
I am totally lost trying to move ~/.m2 to somewhere else. I've tried IntelliJ settings and changed paths and maven settings but didn't work and most of the time they return to the home folder after restarting IntelliJ.
I wanted to add that I didn't install maven (using apt-get install maven). Would this help or give more control?
You can modify the location of the Maven local repository by modifying the Maven settings. From Configuring your Local Repository:
The location of your local repository can be changed in your user configuration. The default value is ${user.home}/.m2/repository/.
<settings>
...
<localRepository>/path/to/local/repo/</localRepository>
...
</settings>
Note: The local repository must be an absolute path.
Since you are using the Maven installation that is shipped with IntelliJ and not your own Maven version, you can create a Maven user settings:
Create a file settings.xml under ${user.home}/.m2/
Have the following content in it:
<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>/path/to/local/repo</localRepository>
</settings>
Maven will read this file and use the specified local repository.
Another alternative I found is also by eclipse itself.
Create the setting.xml file in my D:\TAAS\settings.xml directory as follows:
<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>D:\TAAS\.m2\repository</localRepository>
</settings>
Then I configured it by the eclipse itself according to the following figure.
This is an option for maven embedded versions.

mvn clean install throwing build failure error

I am new to maven. I recently cloned a repository from GIT and saved it in a location on my machine. I have git bash, i am cd'ing to the location where i saved my code and trying to execute the mvn clean install command. but i am seeing the below error. It is unable to locate POM files. How can I solve this problem?. I have tried deleting the code and cloning again but that has not helped.
Below is the POM file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.XXXX</groupId>
<artifactId>XXX-XXX</artifactId>
<version>sprint1506-SNAPSHOT</version>
<packaging>pom</packaging>
<name>XXX-XXX</name>
<url>http://maven.apache.org</url>
<description>
This is the Mega pom to combine XXX, XXX
and XXX projects in a single reactor.
</description>
<modules>
<module>wesp</module>
<module>transite</module>
<module>sassy</module>
</modules>
</project>
Solution 1 : Build it by your own
As OhadR said, your local repository does not contain the jasmine-maven-plugin, so :
Clone the jasmine-maven-plugin repo (git clone git#github.com:searls/jasmine-maven-plugin.git)
Build this plugin with mvn installcommand
Build the project you cloned with mvn install command
Solution 2
If you don't want to rely on your own build, try to add the Sonatype repository to your pom, as an external source. Looking at the plugin jasmine-maven-plugin's pom, it appears that they deploy it on OSS repo.
<project ...>
<repositories>
<repository>
<id>OSS</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
</project>
The problem was fixed when i updated the settings.xml file in apache-maven-3.3.3\conf folder. I had to configure my login credentials in the settings.xml file for the build to complete. I also had to point my .m2/repository directory to the <localRepository> tag inside the settings.xml file for the build to commence. Thanks everyone for the inputs.
Below are the fields which I changed inside the settings.xml file ( highlighted in bold):
****<localRepository>C:\Users\XXX\.m2\repository</localRepository>****
<proxies>
<proxy>
<id>XXXX</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.kdc.XXXXX.com</host>
<port>8099</port>
**<username>XXX</username>**
**<password>XXXX</password>**
<nonProxyHosts>*.XXXXX.com</nonProxyHosts>
</proxy>
</proxies>

No plugin found for prefix 'install' in the current project

I want to add jdbc oracle to maven repository since it is not in repository, I have to run this command:
mvn install:install-file
-Dfile=D:\Temp\ojdbc6.jar
-DgroupId=com.oracle
-DartifactId=ojdbc6 -
Dversion=11.2.0 -Dpackaging=jar
and run into this error:
[ERROR] No plugin found for prefix 'install' in the current project and in the p
lugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the re
positories [local ({my repository path}), central (https://repo.maven.
apache.org/maven2)]
any help would be appropriated.
I recently got the same error and I tried this command. It worked.
export MAVEN_OPTS=-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2
I have faced the same issue, there is a two-step process to resolve this issue:
Configure Maven Proxy Configuration
Open Maven configuration file:
For Linux: ${user.home}/.m2/settings.xml
For Windows: C:\users\username\.m2\settings.xml
If you could find the file open it and search for <proxies></proxies> the segment.
If you cannot find the file, create a new file called settings.xml and add following xml tags <settings></settings>
Add the proxy configurations as below:
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
Update Maven Libraries with a Working Extension
Wagon HTTP lightweight library allows us to connect through NTLM proxies. This can be added as an extension to default Maven libraries.
Download the wagon-http-lightweight-2.2.jar from
https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-http-lightweight/2.2/wagon-http-lightweight-2.2.jar
Copy the downloaded file to %M2_HOME%/lib/ext folder.
Now you are ready to use Maven with your programs.
Try adding this to your Maven configuration file:
<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc14 -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
</dependency>
It should install Oracle JDBC to your repository and should install the necessary JARS.
https://www.tech-recipes.com/rx/39256/add-dependencies-to-maven-pom-xml-file/
Add it within the dependencies tag.
Hope it helps!
[ERROR] No plugin found for prefix ‘install’ in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/amitkumar/.m2/repository), central (https://repo.maven.apache.org/maven2)]
There are 2 steps we need to follow to fix this issues :
Step 1 : Open Maven configuration file: For Linux: ${user.home}/.m2/settings.xml
If you could find the file open it and search for the segment.
If you cannot find the file, create a new file called settings.xml and add following xml tags
Add the proxy configurations as below:
<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">
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>www-proxy.us.oracle.com</host>
<port>80</port>
<nonProxyHosts>adc2170275|*.oracle.com|*.oracleads.com|*.us.oracle.com|
*.uk.oracle.com|*.ca.oracle.com|*.oraclecorp.com|
*.oracleportal.com
</nonProxyHosts>
</proxy>
</proxies>
</settings>
Step 2:
Update Maven Libraries with a Working Extension
Wagon HTTP lightweight library allows us to connect through NTLM proxies. This can be added as an extension to default Maven libraries.
Download the wagon-http-lightweight-2.2.jar from https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-http-lightweight/2.2/wagon-http-lightweight-
2.2.jar
Copy the downloaded file to %M2_HOME%/lib/ext folder.

Resources