无法在 eclipse(Luna) 中创建 Maven 项目

unable to create Maven project in eclipse(Luna)

我正在尝试在 eclipse(Luna) 中创建 Maven 项目,但在创建时出现错误 project.Can 谁能告诉我如何在 Eclipse(Luna) 中创建 Maven 项目。

在工作区->.metadata->.log 文件

!ENTRY org.eclipse.m2e.logback.appender 4 0 2015-07-07 11:17:28.424
!MESSAGE Unable to create project from archetype [co.ntier:spring-mvc-archetype:1.0.2 -> http://maven-repository.com/artifact/co.ntier/spring-mvc-archetype/1.0.2]

!ENTRY org.eclipse.m2e.core 4 -1 2015-07-07 11:17:28.427
!MESSAGE Unable to create project from archetype [co.ntier:spring-mvc-archetype:1.0.2 -> http://maven-repository.com/artifact/co.ntier/spring-mvc-archetype/1.0.2]
!STACK 0
org.apache.maven.archetype.exception.ArchetypeGenerationFailure: The defined artifact is not an archetype
    at org.apache.maven.archetype.generator.DefaultArchetypeGenerator.generateArchetype(DefaultArchetypeGenerator.java:152)
    at org.apache.maven.archetype.generator.DefaultArchetypeGenerator.generateArchetype(DefaultArchetypeGenerator.java:286)
    at org.apache.maven.archetype.DefaultArchetype.generateProjectFromArchetype(DefaultArchetype.java:69)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.createArchetypeProjects0(ProjectConfigurationManager.java:770)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.call(ProjectConfigurationManager.java:719)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.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.doCreateMavenProjects(MavenProjectWizard.java:244)
    at org.eclipse.m2e.core.ui.internal.wizards.AbstactCreateMavenProjectJob.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)

eclipse 似乎无法生成此工件,因为给定的参数有误。尝试使用命令行创建它,然后将其作为 maven 项目导入到 eclipse 中:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeGroupId=co.ntier -DarchetypeArtifactId=spring-mvc-archetype -DarchetypeVersion=1.0.2 -DinteractiveMode=false

对我来说,接受的答案没有用。如果您遇到同样的问题,请尝试以下操作。

文件 -> 新建项目 -> Maven 项目 -> 下一步 -> 单击添加原型

输入以下详细信息

Archetype Group Id: co.ntier

Archetype Artifact Id: spring-mvc-archetype

Archetype Version: 1.0.2

Repository URL: http://repo.maven.apache.org/maven2/

如果再次失败,删除 .m2/repository 文件夹中的所有内容,然后重试上述步骤。