简体   繁体   English

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

[英]Unable to create project from archetype in Eclipse Luna

I am trying to create a simple Maven project in Eclipse Luna.我正在尝试在 Eclipse Luna 中创建一个简单的 Maven 项目。 As this is my first maven project so I am starting with a simple one.由于这是我的第一个 maven 项目,所以我从一个简单的项目开始。 I am trying to crate a simple web project using the webapp-j2ee14 archetype.我正在尝试使用webapp-j2ee14原型创建一个简单的 web 项目。

While creating I found that this archetype is not present in archetype list.创建时我发现原型列表中不存在此原型。 So I tried with Add Archetype option 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.xml file in .m2 directory 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...现在,当我单击完成时,出现以下错误...

在此处输入图像描述

I tried with few other repo url after searching google but getting the same error.在搜索谷歌但得到相同的错误后,我尝试使用其他几个 repo url。 Where can I get the correct repo url for this archetype??我在哪里可以获得此原型的正确回购协议 url?

Thanks in advance...提前致谢...

Add Remote Archetype in your eclipse it will show you that option.在你的 eclipse 中添加 Remote Archetype 它会告诉你那个选项。 Following are the steps:以下是步骤:

  1. File--->New---> Maven Project---->Next--->Click on tab Configure文件--->新建---> Maven项目---->下一步--->点击选项卡配置

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

  3. Now in new Maven Project select Remote Archetype from Catalog and you will find webapp-j2ee14 option there.现在在新的 Maven 项目中,从目录中选择远程原型,你会在那里找到 webapp-j2ee14 选项。

I got the same problem and i was creating a simple Web App.我遇到了同样的问题,我正在创建一个简单的 Web 应用程序。 I created the MAVEN project first then i deleted it and again when i created it i got this error.我首先创建了 MAVEN 项目,然后将其删除,再次创建时出现此错误。 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.我使用的是我添加到我的 MAVEN 项目中的原型的 2.16 版本,将其更改为最新的 2.26 并且它对我有用。 You can check the latest version from http://repo1.maven.org/maven2/archetype-catalog.xml您可以从http://repo1.maven.org/maven2/archetype-catalog.xml查看最新版本

I got this problem as I have deleted a previously created project from Eclipse.我遇到了这个问题,因为我从 Eclipse 中删除了以前创建的项目。 Later, I deleted the .metadata file and the project from workspace.后来,我从工作区中删除了 .metadata 文件和项目。 Then this problem was resolved.然后这个问题就解决了。

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

I think the work space has messed up of some reason.我认为工作空间由于某种原因搞砸了。 These steps below may help以下这些步骤可能会有所帮助

  1. Close eclipse关闭日食
  2. delete the .metadata directory删除.metadata目录
  3. Restart the eclipse, pointing to same workspace and try the process to create new maven project重新启动 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切换到一个全新的工作区并尝试相同的过程来创建您的 Maven 项目

This is worked for me!这对我有用!

After working whole day, finally I found the solution.经过一整天的工作,我终于找到了解决方案。 I just went to Eclipse marketlace(help-Eclipse marketplace) and updated maven from there.我刚刚去了 Eclipse 市场(帮助-Eclipse 市场)并从那里更新了 maven。 Now it works wonders.现在它创造了奇迹。 Earlier I was unable to install TestNG plugin from Eclipse marketplace, but now after updating maven from there, Testng plugin successfully installed in my eclipse luna.早些时候我无法从 Eclipse 市场安装 TestNG 插件,但现在从那里更新 maven 后,Testng 插件成功安装在我的 eclipse luna 中。

I was trying to create a maven archetype quickstart and faced this issue, I have never created any maven project before so for those below is the steps you need to follow -我试图创建一个maven 原型快速入门并遇到了这个问题,我之前从未创建过任何 maven 项目,所以对于下面的那些是你需要遵循的步骤 -

  1. Go to to Run -> Run As -> Maven Install Go运行 -> 运行方式 -> Maven 安装
  2. In the project explorer right click on pom.xml file -> Maven -> Update project.在项目资源管理器中右键单击pom.xml 文件 -> Maven -> 更新项目。

This will for sure resolve the issue.这肯定会解决问题。

Eclipse version I am using: 2021-09 (4.21.0) Eclipse 我用的版本:2021-09 (4.21.0)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM