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>[email protected]</username>
<password>{XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX}</password>
</server>
<server>
<id>deployment</id>
<username>[email protected]</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
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.
For me the solution was a bit simpler, I just had to clean the repository : .m2/repository/org/apache/maven/archetypes
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.
Just delete the ${user.home}/.m2/repository/org/apache/maven/archetypes to refresh all files needed, it worked fine to me!
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".
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!
In my case following solution worked.
I hope this may help someone.
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>
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)..
Source: Stackoverflow.com