java – 创建Maven项目,无法解析原型,拒绝连接

前端之家收集整理的这篇文章主要介绍了java – 创建Maven项目,无法解析原型,拒绝连接前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我怀疑我有Maven代理问题.当我创建一个新项目时:

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: 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

我们可以看到问题的根源:连接被拒绝:连接

我已经这样做了:

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项目?

解决方法

我有同样的问题,我想在某个时候你试图创建那个没有像我这样的连接的maven应用程序,这是导致这个问题的原因.因为第一次Maven创建一个空目录尝试下载创建项目所需的任何东西..在你创建的任何maven项目之后,Maven一直在寻找那个目录,从网上下载东西. 我相信解决这个问题的最简单方法关闭Eclipse(或sts)并删除位于(在我的情况下)“c:/Users/myname/.m2”中的.m2目录.然后重新打开您正在使用的IDE. 祝好运
原文链接:https://www.f2er.com/java/129933.html

猜你在找的Java相关文章