1)文件 – >新 – > Maven项目
2)我选择原型:in org.apache.maven.archetypes – > Maven的原型 – web应用
3)我得到这个错误:
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.
细节 :
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)
在.log文件中:
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: connectENTRY 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: connectENTRY 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
我们可以看到问题的根源:连接被拒绝:连接
我已经这样做了:
1)窗口 – >偏好 – >一般 – >网络连接.我在我的代理的url和端口输入了Manual for HTTP protocol.
它的工作原理是因为在此之前,Spring Tool Suite不想更新.之后,没关系.
2)窗口 – >偏好 – > Maven – >用户设置.在“全局设置”中,为空.在“用户设置”中,我将路径设置为settings.xml.在这个文件中,我有:
<settings> <proxies> <proxy> <active>true</active> <protocol>http</protocol> <host>my.proxy.fr</host> <port>3128</port> </proxy> </proxies> </settings>
在本主题中:
Create a Maven project in Eclipse complains “Could not resolve archetype”
通过添加远程目录http://repo1.maven.org/maven2/archetype-catalog.xml解决了该问题.
对我来说,它说目录是空的.
我的配置:
Windows 7 Pro 64位,Spring工具套件3.6.4.RELEASE基于Eclipse Luna SR1(4.4.2),Java版本8 Update 45,无认证代理
为什么我不能创建一个新的Maven项目?