将原型添加到 Eclipse

Add Archtypes to Eclipse

我是 MAVEN 和 restful 服务的新手。我已经正确安装了 MAVEN 并设置了变量。我正在使用 jersey-quickstart-webapp 创建一个网络服务,但发现它没有出现在原型列表中。 我尝试使用 ADD Archetypes 选项添加它。输入详细信息后

GroupId: org.glassfish.jersey.archetypes
ArtifactId:  jersey-quickstart-webapp
Version : 2.16  // version is correct??

I get following error please help. 

<b>
org.eclipse.core.runtime.CoreException: Could not resolve artifact 
org.glassfish.jersey.archetypes:jersey-quickstart-webapp:pom:2.16</b>

关于为什么 Eclipse 原型插件给你这个错误,我没有现成的解释,因为 2.16jersey-quickstart-webapp 的有效版本。但是,我建议您尝试从命令提示符手动执行以下命令:

mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-webapp
    -DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false
    -DgroupId=com.example -DartifactId=simple-service-webapp -Dpackage=com.example
    -DarchetypeVersion=2.19

确保先从 Maven .m2 目录中删除 jersey-quickstart-webapp 文件夹(如果存在)。这可能是必要的,以避免在原型安装过程中出现损坏。

这里 link to the official documentation 从 Maven 原型创建 Jersey EE 应用程序。