无法从 Eclipse Luna 中的原型创建项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26698239/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 22:09:50  来源:igfitidea点击:

Unable to create project from archetype in Eclipse Luna

javaeclipsemavenjakarta-ee

提问by Siddharth

I am trying to create a simple Maven project in Eclipse Luna. As this is my first maven project so I am starting with a simple one. I am trying to crate a simple web project using the webapp-j2ee14archetype.

我正在尝试在 Eclipse Luna 中创建一个简单的 Maven 项目。因为这是我的第一个 Maven 项目,所以我从一个简单的项目开始。我正在尝试使用webapp-j2ee14原型创建一个简单的 Web 项目。

While creating I found that this archetype is not present in archetype list. So I tried with Add Archetypeoption and Provided the following archetype options.

在创建时,我发现原型列表中不存在此原型。所以我尝试使用添加原型选项并提供以下原型选项。

<archetype>
  <groupId>org.codehaus.mojo.archetypes</groupId>
  <artifactId>webapp-j2ee14</artifactId>
  <version>1.3</version>
  <repository>http://repo1.maven.org/maven2/org/codehaus/mojo/archetypes/webapp-j2ee14/1.3/</repository>
</archetype>

The above code snippet is basically from archetype-catalog.xmlfile in .m2directory in my system, but I actually entered them from eclipse UI.

上面的代码片段基本上来自我系统中.m2目录中的archetype-catalog.xml文件,但我实际上是从 eclipse UI 输入的。

Now, when I am clicking finish it's giving me the following error...

现在,当我点击完成时,它给了我以下错误......

enter image description here

在此处输入图片说明

I tried with few other repo url after searching google but getting the same error. Where can I get the correct repo url for this archetype??

在搜索谷歌后,我尝试了其他一些 repo url,但遇到了同样的错误。我在哪里可以获得此原型的正确 repo url?

Thanks in advance...

提前致谢...

回答by Suman

Add Remote Archetype in your eclipse it will show you that option. Following are the steps:

在您的日食中添加远程原型,它将向您显示该选项。以下是步骤:

  1. File--->New---> Maven Project---->Next--->Click on tab Configure

  2. Separate window will open... Maven-->Archetypes-->Click on Add Remote Catalog--> In Catalog File type "http://repo1.maven.org/maven2/archetype-catalog.xml" and click on Apply and then Ok

  3. Now in new Maven Project select Remote Archetype from Catalog and you will find webapp-j2ee14 option there.

  1. 文件--->新建---> Maven项目---->下一步--->点击选项卡配置

  2. 将打开单独的窗口... Maven--> Archetypes--> 单击添加远程目录--> 在目录文件中键入“ http://repo1.maven.org/maven2/archetype-catalog.xml”,然后单击应用然后好的

  3. 现在在新的 Maven 项目中,从目录中选择远程原型,你会在那里找到 webapp-j2ee14 选项。

回答by Mohan Tenneti

I got this problem as I have deleted a previously created project from Eclipse. Later, I deleted the .metadata file and the project from workspace. Then this problem was resolved.

我遇到了这个问题,因为我从 Eclipse 中删除了以前创建的项目。后来,我从工作区中删除了 .metadata 文件和项目。然后这个问题就解决了。

回答by sohalsaab

I got the same problem and i was creating a simple Web App. I created the MAVEN project first then i deleted it and again when i created it i got this error. So i changed the version of archetype. I was using 2.16 version of the archetype that i was adding to my MAVEN project, changed it to latest 2.26 and it worked for me. You can check the latest version from http://repo1.maven.org/maven2/archetype-catalog.xml

我遇到了同样的问题,我正在创建一个简单的 Web 应用程序。我首先创建了 MAVEN 项目,然后将其删除,再次创建时出现此错误。所以我改变了原型的版本。我使用的是我添加到我的 MAVEN 项目中的原型的 2.16 版本,将其更改为最新的 2.26 并且它对我有用。您可以从http://repo1.maven.org/maven2/archetype-catalog.xml查看最新版本

回答by Ram

I think the work space has messed up of some reason. These steps below may help

我认为工作空间由于某种原因搞砸了。以下这些步骤可能会有所帮助

  1. Close eclipse
  2. delete the .metadatadirectory
  3. Restart the eclipse, pointing to same workspace and try the process to create new maven project
  1. 关闭日食
  2. 删除.metadata目录
  3. 重新启动 eclipse,指向相同的工作区并尝试创建新的 maven 项目的过程

or if this approach didn't work

或者如果这种方法不起作用

  1. switch to a fresh new workspace and try the same process to create your maven project
  1. 切换到一个全新的工作区并尝试相同的过程来创建您的 Maven 项目

This is worked for me!

这对我有用!

回答by Shivdas

I got same issue, I have solved by manually removing unused pom.xmlfile at the working workspace or root of workspace directory.

我遇到了同样的问题,我通过手动删除工作工作区或工作区目录根中未使用的pom.xml文件来解决。