Create Maven project, could not resolve archetype,

2019-04-23 16:03发布

I suspect that I have a Maven proxy problem. When I create a new project :

1) File -> New -> Maven Project

2) I choose the archetype : in org.apache.maven.archetypes -> maven-archetype-webapp

3) And I get this error :

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:RELEASE from any of the configured repositories.

Creating maven-archetype-webapp' has encountered a problem. Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webap p:RELEASE from any of the configured repositories.

The detail :

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:RELE ASE from any of the configured repositories. Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:p om:RELEASE Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp :pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp /maven-metadata.xml in local (D:\ Users\ dlefebvreVm2 \ repository) Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp :pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp /maven-metadata.xml in local (D:\ Users\ dlefebvreVm2 \ repository)

And in .log file :

ENTRY org.eclipse.m2e.logback.appender 2 0 2015-05-18 09:30:10.373 !MESSAGE Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml from 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. Original error: Could not transfer metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml from/to central (repo.maven.apache.org/maven2): Connection refused: connect

ENTRY org.eclipse.m2e.logback.appender 2 0 2015-05-18 09:30:13.259 !MESSAGE Failure to transfer org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml from 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. Original error: Could not transfer metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml from/to central (repo.maven.apache.org/maven2): Connection refused: connect

ENTRY org.eclipse.m2e.core 4 -1 2015-05-18 09:30:13.329 !MESSAGE Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:RELEASE from any of the configured repositories. !STACK 1 org.eclipse.core.runtime.CoreException: Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE at org.eclipse.m2e.core.internal.embedder.MavenImpl$5.call(MavenImpl.java:769) at org.eclipse.m2e.core.internal.embedder.MavenImpl$5.call(MavenImpl.java:1) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:166) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:109) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:96) at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:736) at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:713) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.resolveArchetype(ProjectConfigurationManager.java:829) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.createArchetypeProjects0(ProjectConfigurationManager.java:743) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$5.call(ProjectConfigurationManager.java:719) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$5.call(ProjectConfigurationManager.java:1) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:166) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:142) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:96) at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1348) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.createArchetypeProjects(ProjectConfigurationManager.java:717) at org.eclipse.m2e.core.ui.internal.wizards.MavenProjectWizard$5.doCreateMavenProjects(MavenProjectWizard.java:244) at org.eclipse.m2e.core.ui.internal.wizards.AbstactCreateMavenProjectJob$1.doCreateMavenProjects(AbstactCreateMavenProjectJob.java:46) at org.eclipse.m2e.core.ui.internal.wizards.AbstractCreateMavenProjectsOperation.run(AbstractCreateMavenProjectsOperation.java:62) at org.eclipse.m2e.core.ui.internal.wizards.AbstactCreateMavenProjectJob.runInWorkspace(AbstactCreateMavenProjectJob.java:50) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Contains: Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (D:\Users\dlefebvre.m2\repository) org.eclipse.aether.resolution.VersionResolutionException: Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (D:\Users\dlefebvre.m2\repository) at org.apache.maven.repository.internal.DefaultVersionResolver.resolveVersion(DefaultVersionResolver.java:312) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:318) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239) at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:295) at org.eclipse.m2e.core.internal.embedder.MavenImpl$5.call(MavenImpl.java:746) at org.eclipse.m2e.core.internal.embedder.MavenImpl$5.call(MavenImpl.java:1) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:166) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:109) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:96) at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:736) at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:713) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.resolveArchetype(ProjectConfigurationManager.java:829) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.createArchetypeProjects0(ProjectConfigurationManager.java:743) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$5.call(ProjectConfigurationManager.java:719) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$5.call(ProjectConfigurationManager.java:1) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:166) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:142) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:96) at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1348) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.createArchetypeProjects(ProjectConfigurationManager.java:717) at org.eclipse.m2e.core.ui.internal.wizards.MavenProjectWizard$5.doCreateMavenProjects(MavenProjectWizard.java:244) at org.eclipse.m2e.core.ui.internal.wizards.AbstactCreateMavenProjectJob$1.doCreateMavenProjects(AbstactCreateMavenProjectJob.java:46) at org.eclipse.m2e.core.ui.internal.wizards.AbstractCreateMavenProjectsOperation.run(AbstractCreateMavenProjectsOperation.java:62) at org.eclipse.m2e.core.ui.internal.wizards.AbstactCreateMavenProjectJob.runInWorkspace(AbstactCreateMavenProjectJob.java:50) 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.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (D:\Users\dlefebvre.m2\repository) at org.eclipse.aether.internal.impl.DefaultMetadataResolver.resolve(DefaultMetadataResolver.java:260) at org.eclipse.aether.internal.impl.DefaultMetadataResolver.resolveMetadata(DefaultMetadataResolver.java:218) at org.apache.maven.repository.internal.DefaultVersionResolver.resolveVersion(DefaultVersionResolver.java:250) ... 26 more !SUBENTRY 1 org.eclipse.m2e.core 4 -1 2015-05-18 09:30:13.334 !MESSAGE Could not resolve artifact org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE !SUBENTRY 2 org.eclipse.m2e.core 4 -1 2015-05-18 09:30:13.334 !MESSAGE Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (D:\Users\dlefebvre.m2\repository) !STACK 0 org.eclipse.aether.resolution.VersionResolutionException: Failed to resolve version for org.apache.maven.archetypes:maven-archetype-webapp:pom:RELEASE: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (D:\Users\dlefebvre.m2\repository) at org.apache.maven.repository.internal.DefaultVersionResolver.resolveVersion(DefaultVersionResolver.java:312) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:318) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239) at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:295) at org.eclipse.m2e.core.internal.embedder.MavenImpl$5.call(MavenImpl.java:746) at org.eclipse.m2e.core.internal.embedder.MavenImpl$5.call(MavenImpl.java:1) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:166) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:109) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:96) at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:736) at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:713) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.resolveArchetype(ProjectConfigurationManager.java:829) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.createArchetypeProjects0(ProjectConfigurationManager.java:743) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$5.call(ProjectConfigurationManager.java:719) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$5.call(ProjectConfigurationManager.java:1) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:166) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:142) at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:96) at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1348) at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.createArchetypeProjects(ProjectConfigurationManager.java:717) at org.eclipse.m2e.core.ui.internal.wizards.MavenProjectWizard$5.doCreateMavenProjects(MavenProjectWizard.java:244) at org.eclipse.m2e.core.ui.internal.wizards.AbstactCreateMavenProjectJob$1.doCreateMavenProjects(AbstactCreateMavenProjectJob.java:46) at org.eclipse.m2e.core.ui.internal.wizards.AbstractCreateMavenProjectsOperation.run(AbstractCreateMavenProjectsOperation.java:62) at org.eclipse.m2e.core.ui.internal.wizards.AbstactCreateMavenProjectJob.runInWorkspace(AbstactCreateMavenProjectJob.java:50) 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.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata org.apache.maven.archetypes:maven-archetype-webapp/maven-metadata.xml in local (D:\Users\dlefebvre.m2\repository) at org.eclipse.aether.internal.impl.DefaultMetadataResolver.resolve(DefaultMetadataResolver.java:260) at org.eclipse.aether.internal.impl.DefaultMetadataResolver.resolveMetadata(DefaultMetadataResolver.java:218) at org.apache.maven.repository.internal.DefaultVersionResolver.resolveVersion(DefaultVersionResolver.java:250) ... 26 more

We can see the origin of the problem : Connection refused: connect

I have already do this :

1) Window -> Preferences -> General -> Network Connections. I put in Manual with the url and port of my proxy for HTTP protocol. It works because before this, Spring Tool Suite did not want to update. After, it's okay.

2) Window -> Preferences -> Maven -> User Settings. In Global Settings, is empty. In User Settings, I put the path to settings.xml. In this file, i have :

<settings>
  <proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>my.proxy.fr</host>
      <port>3128</port>
    </proxy>
  </proxies>
</settings>

In this topic : Create a Maven project in Eclipse complains "Could not resolve archetype" The problem was solved with adding the remote catalog http://repo1.maven.org/maven2/archetype-catalog.xml. For me, it said that the catalog is empty.

My configuration: Windows 7 Pro 64 bit, Spring tool suite 3.6.4.RELEASE based on Eclipse Luna SR1 (4.4.2), Java version 8 Update 45, No authenticated proxy

Why can't I create a new Maven project?

4条回答
该账号已被封号
2楼-- · 2019-04-23 16:14

I had the same problem. I fixed it by adding the maven archetype catalog to eclipse. Steps are provided below:

  1. Open Window
  2. Preferences Open Maven
  3. Archetypes Click 'Add Remote
  4. Catalog' and add the following:

Catalog File: http://repo1.maven.org/maven2/archetype-catalog.xml

Description: maven catalog

查看更多
啃猪蹄的小仙女
3楼-- · 2019-04-23 16:21

i also had the same problem, i resolved it by deleting .m2 in c:/user/{user_name}/.m2

i hope it can help.

查看更多
Melony?
4楼-- · 2019-04-23 16:23

I had the same problem, I think in a certain time you tried to create that maven app without connection like me and that what causes this problem. Because the first time Maven creates an empty directory try to download whatever it needs to create the project ..after that any maven project you create, Maven keeps looking just in that directory whitout downloading things from the internet. I beleive the easiest way to solve this problem is to close Eclipse(or sts) and delete the .m2 directory located in (in my case) "c:/Users/myname/.m2". and then reopen the IDE you were using. Good luck

查看更多
女痞
5楼-- · 2019-04-23 16:27

Restart your eclipse after changing proxy settings in c:/user/{user_name}/.m2

查看更多
登录 后发表回答