Reputation: 562
I have Eclipse Luna and Maven 3.2.3 installed on a Windows 7 machine behind a corporate firewall.
Trying to create a project from an archetype results in the following error:
Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE from any of the configured repositories.
Could not resolve artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE
Failed to resolve version for org.apache.maven.archetypes:maven-archetype- quickstart:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xml in local (C:\Users\xxxx.m2\repository)
Failed to resolve version for org.apache.maven.archetypes:maven-archetype-quickstart:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-quickstart/maven-metadata.xml in local (C:\Users\xxxx.m2\repository)
Proxy details are configured in .m2/settings.xml
and generating a maven project from an archtype works fine in command line.
I tried to apply the solutions from here but none worked. The remote catalog is not acessible as well. I reckon it's a problem with the network settings of Eclipse. I also looked at this bug report to try and find some clues and couldn't really understand how to implement the workaround.
here is my settings.xml file:
<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">
<servers>
<server>
<id>nexus</id>
<username>xxxx@xxxx.com</username>
<password>{XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}</password>
</server>
<server>
<id>deployment</id>
<username>xxxx@xxxx.com</username>
<password>{XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}</password>
</server>
</servers>
<mirrors>
<mirror>
<!--This sends everything else to /public -->
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>https://nexus-int.xxxx.xxxx.com/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>
Any ideas?
Thanks
Tomer
Upvotes: 32
Views: 155499
Reputation: 892
Today this issue, consumed nearly entire day of mine. Hence, thought to share learning if it can save time of others.
It seems Eclipse Luna had issue. I tried bunch of things, but problem remain unresolved with Eclipse Luna.
Subsequently, I tried Eclipse Neon and problem is auto-resolved with Neon. It seems when the issue was posted here (as it's quite old), Neon version may not have been released.
So in summary, If anyone is yet using Java-8, Maven than by using Eclipse Neon you should not face an issue.
Also, what I learnt is that Maven-be it embedded (Internal to Eclipse) or external (which we install separately) don't make any difference here.
So now my working stack - JDK 8, Maven 3, Eclipse Neon
Ref: Eclipse Neon link for download - https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/neon/3/eclipse-jee-neon-3-win32-x86_64.zip
PS - Also, I tried latest version of Eclipse (R) named as "eclipse-jee-2021-03-R-win32-x86_64", however it requires minimal version as Java-11, so for Java 8 we can't use it.
Upvotes: 0
Reputation: 7862
It worked for = I just removed "archetypes" folder from below location
C:\Users\Lenovo.m2\repository\org\apache\maven
But you may change following for experiment - download latest binary zip of Maven, add to you C:\ drive and change following....
Change Proxy
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username></username>
<password></password>
<host>10.23.73.253</host>
<port>8080</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
Upvotes: 0
Reputation: 151
It's actually easy and straight forward.
just navigate to your .m2 folder.
.m2/repository/org/apache/maven
inside this maven folder, you will see a folder called Archetypes... delete this folder and the problem is solved.
but if you don't feel like deleting the whole folder, you can navigate into the archetype folder and delete all the archetype you want there. The reason why it keeps failing is because, the archetype you are trying to create is trying to tell you that she already exists in that folder, hence move away...
summarily, deleting the archetype folder in the .m2 folder is the easiest solution.
Upvotes: 3
Reputation: 4741
If you're behind a proxy, the very first thing to do is, add settings.xml
with proxy configs under C:\Users\{username}\.m2
folder, and replicate same proxy configs under Window > Preferences > Network Connections
(you may need to prefix your user name with domain eg. DOMAIN\username
):
<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>webproxy.net</host>
<port>8080</port>
<username>username</username>
<password>password</password>
<nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
</proxy>
<proxy>
<active>true</active>
<protocol>https</protocol>
<host>webproxy.net</host>
<port>8080</port>
<username>username</username>
<password>password</password>
<nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
</proxy>
</proxies>
Delete C:\Users\{username}\.m2\repository
folder as well.
Upvotes: 0
Reputation: 61
I GOT THIS problem too, and I solved it finally, this is the solution:
go to windows-->preference-->maven-->user settings
Change the settings.xml
path to a valid path.
The path maybe not under .m2 directory (in your home directory)..
Upvotes: 4
Reputation: 1493
I had the same error show up while creating the project but I wasn't behind a proxy and hence the above solutions did not work for me.
I found this forum. It suggested to:
- Delete or Rename .m2 directory from your HOME directory
In Windows - C:\Users\<username>\Windows
OR
In Linux - /home/<username>
- restart the Eclipse / STS spring tool suite (which am using)
It worked!
Upvotes: 1
Reputation: 92
I am using Spring STS 3.8.3. I had a similar problem. I fixed it by using information from this thread And also by fixing some maven settings. click Spring Tool Suite -> Preferences -> Maven and uncheck the box that says "Do not automatically update dependencies from remote depositories" Also I checked the boxes that say "Download Artifact Sources" and "download Artifact javadoc".
Upvotes: 0
Reputation: 2807
In my case following solution worked.
I hope this may help someone.
Upvotes: 3
Reputation: 889
Just delete the ${user.home}/.m2/repository/org/apache/maven/archetypes to refresh all files needed, it worked fine to me!
Upvotes: 15
Reputation: 1144
Same problem here, solved.
I will explain the problem and the solution, to help others.
My software is:
Windows 7
Eclipse 4.4.1 (Luna SR1)
m2e 1.5.0.20140606-0033
(from eclipse repository: http://download.eclipse.org/releases/luna)
And I'm accessing internet through a proxy.
My problem was the same:
After a lot of try-and-error, and reading a lot of pages, I've finally found a solution to fix it. Some important points of the solution:
The solution is:
<settings> <proxies> <proxy> <active>true</active> <protocol>http</protocol> <host>YOUR.PROXY.IP.OR.NAME</host> <port>YOUR PROXY PORT</port> <username>YOUR PROXY USERNAME (OR EMPTY IF NOT REQUIRED)</username> <password>YOUR PROXY PASSWORD (OR EMPTY IF NOT REQUIRED)</password> <nonProxyHosts>YOUR PROXY EXCLUSION HOST LIST (OR EMPTY)</nonProxyHosts> </proxy> </proxies> </settings>
Finally, I would like to give a suggestion to m2e developers, to make config easier. After installing m2e from the internet (from a repository), m2e should check if Eclipse is using a proxy (Preferences > General > Network Connections). If Eclipse is using a proxy, the m2e should show a dialog to the user:
m2e has detected that Eclipse is using a proxy to access to the internet.
Would you like me to create a User settings file (settings.xml) for the embedded
Maven software?
[ Yes ] [ No ]
If the user clicks on Yes, then m2e should create automatically the "settings.xml" file by copying proxy values from Eclipse preferences.
Upvotes: 59
Reputation: 2503
For me the solution was a bit simpler, I just had to clean the repository : .m2/repository/org/apache/maven/archetypes
Upvotes: 36