Java 在 Eclipse 中添加 org.glassfish.jersey.archetypes
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31721013/
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
Adding org.glassfish.jersey.archetypes in eclipse
提问by user1326301
I am trying to create a maven project in eclipse. I am trying create a archetype but getting the below error.
我正在尝试在 Eclipse 中创建一个 Maven 项目。我正在尝试创建一个原型,但出现以下错误。
Can't resolve Archetype org.glassfish.jersey.archetypes:jersey-quickstart-webapp:2.16
org.eclipse.core.runtime.CoreException: Could not resolve artifact org.glassfish.jersey.archetypes:jersey-quickstart-webapp:pom:2.16
无法解析 Archetype org.glassfish.jersey.archetypes:jersey-quickstart-webapp:2.16
org.eclipse.core.runtime.CoreException: 无法解析工件 org.glassfish.jersey.archetypes:jersey-quickstart-webapp:pom: 2.16
回答by sreejith v s
You can solve this issue by adding a new Maven Archetype.
您可以通过添加新的 Maven Archetype 来解决此问题。
- Open
Window > Preferences
- Open
Maven > Archetypes
- Click
Add Remote Catalog
and add the following:- Catalog File:
https://repo.maven.apache.org/maven2/archetype-catalog.xml
- Description:
maven catalog
- Catalog File:
- Restart eclipse
- 打开
Window > Preferences
- 打开
Maven > Archetypes
- 单击
Add Remote Catalog
并添加以下内容:- 目录文件:
https://repo.maven.apache.org/maven2/archetype-catalog.xml
- 说明:
maven catalog
- 目录文件:
- 重启日食
Try creating a maven project again. It will work :).
再次尝试创建一个 Maven 项目。它会起作用:)。
{search filter:jersey-quickstart-webapp}
You will have the latest version.
您将拥有最新版本。
回答by Deepak Acharya
One point I want to add, If you are getting following error while installing the archetype showed in image 1
我想补充一点,如果您在安装图 1 中显示的原型时遇到以下错误
Can't resolve Archetype org.glassfish.jersey.archetypes:jersey-quickstart-webapp:2.21 org.eclipse.core.runtime.CoreException: Could not resolve artifact org.glassfish.jersey.archetypes:jersey-quickstart-webapp:pom:2.21
无法解析 Archetype org.glassfish.jersey.archetypes:jersey-quickstart-webapp:2.21 org.eclipse.core.runtime.CoreException: 无法解析工件 org.glassfish.jersey.archetypes:jersey-quickstart-webapp:pom: 2.21
Then before procedding with the solution specified in this page, try to complete these stepsin eclipse.
然后在继续使用本页中指定的解决方案之前,尝试在 eclipse 中完成这些步骤。
回答by Nitesh Goyal
You can solve this issue by adding a new Maven Archetype locally. By locally, I mean-
您可以通过在本地添加新的 Maven Archetype 来解决此问题。在本地,我的意思是-
- Go to this URLand download the XML file at your local file system.
- Open
Window > Preferences
- Open
Maven > Archetypes
- Click Add Local Catalog > Browse to the location of your
archetype-catalog.xml
file - Add Descritpion
- OK
- 转到此URL并在本地文件系统中下载 XML 文件。
- 打开
Window > Preferences
- 打开
Maven > Archetypes
- 单击添加本地目录 > 浏览到
archetype-catalog.xml
文件所在的位置 - 添加描述
- 好的
Hope this will help you.
希望这会帮助你。
回答by Noothan y v
There could be issue with internet connecting to your eclipse marketplace. below changes would solve your issue
互联网连接到您的日食市场可能存在问题。以下更改将解决您的问题
Open Window > Preferences>Open Maven > Archetypes Click on Add Remote Catalog Catalog File: http://repo1.maven.org/maven2/archetype-catalog.xmlDone Create Project, you should be able to see archtypes of jersey
Open Window > Preferences > Open Maven > Archetypes 点击Add Remote Catalog Catalog File:http: //repo1.maven.org/maven2/archetype-catalog.xml Done Create Project,你应该可以看到jersey的archtypes
回答by ram kumar
Try to change the version 2.21insted of 2.16:
尝试更改2.16 的2.21insted版本:
org.glassfish.jersey.archetypes jersey-quickstart-webapp 2.21
回答by Nupur
Thanks @sreejith v s . The above mentioned method worked completely fine .I'll repeat the same steps here:-
谢谢@sreejith vs . 上面提到的方法工作得很好。我会在这里重复相同的步骤:-
- Open Window > Preferences
- Open Maven > Archetypes
Click Add Remote Catalog and add the following:
3.1 Catalog File: http://repo1.maven.org/maven2/archetype-catalog.xml
3.2 Description: maven catalog
Restart eclipse
- 打开窗口 > 首选项
- 打开 Maven > 原型
单击添加远程目录并添加以下内容:
3.1 目录文件:http: //repo1.maven.org/maven2/archetype-catalog.xml
3.2 说明:maven目录
重启日食
While creating maven project your window might take time to load all the Archetype but it does load all of them because here we have added the archetype-catalog.xml as remote catalog file.
在创建 maven 项目时,您的窗口可能需要时间来加载所有原型,但它确实加载了所有原型,因为这里我们添加了 archetype-catalog.xml 作为远程目录文件。
回答by crazysj
Steps
脚步
- Open Eclipse
- Choose
New > Project > Maven Project
- Choose
Add Archetype
and enter the following details:- Archetype Group ID:
org.glassfish.jersey.archetypes
- Archetype Artifact ID:
jersey-quickstart-webapp
- Archetype Version:
2.16
[enter the latest version that is available]
- Archetype Group ID:
- Choose the newly entered archetype from the Archetype selection screen
- Enter your project details -
Group ID
,Artifact ID
andVersion
.
- 打开日食
- 选择
New > Project > Maven Project
- 选择
Add Archetype
并输入以下详细信息:- 原型组 ID:
org.glassfish.jersey.archetypes
- 原型工件 ID:
jersey-quickstart-webapp
- 原型版本:
2.16
[输入可用的最新版本]
- 原型组 ID:
- 从原型选择屏幕中选择新输入的原型
- 输入您的项目详细信息 -
Group ID
、Artifact ID
和Version
。
More Information: https://javabrains.io/courses/javaee_jaxrs/lessons/Setting-Up
更多信息:https: //javabrains.io/courses/javaee_jaxrs/lessons/Setting-Up
回答by Abhishek
Please ensure that you have correct entries into your settings.xml which is located at .m2/settings.xmlor {maven_home}/conf/settings.xml
请确保您在位于.m2/settings.xml或{maven_home}/conf/settings.xml 的settings.xml 中有正确的条目
<settings>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>YOUR.PROXY.IP.OR.NAME</host>
<port>YOUR PROXY PORT</port>
<username>YOUR PROXY USERNAME (OR EMPTY IF NOT REQUIRED)</username>
<password>YOUR PROXY PASSWORD (OR EMPTY IF NOT REQUIRED)</password>
<nonProxyHosts>YOUR PROXY EXCLUSION HOST LIST (OR EMPTY)</nonProxyHosts>
</proxy>
</proxies>
</settings>
If you are building from your eclipse ensure that Windows>Preference>{Search Maven}>{Select "User Settings"}>{Update settings.xml location}
如果您从 Eclipse 构建,请确保Windows>Preference>{Search Maven}>{Select "User Settings"}>{Update settings.xml location}
If you are building from command line you may directly use:
如果您是从命令行构建,则可以直接使用:
mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes -DarchetypeArticfactId=jersey-quickstart.webapp -DarchetypeVersion=2.28 -DinteractiveMode=false
回答by Ashwin
For me it worked with https instead of http in the below URL http://repo1.maven.org/maven2/archetype-catalog.xml
对我来说,它在下面的 URL http://repo1.maven.org/maven2/archetype-catalog.xml 中使用 https 而不是 http
Can use the 'Verify' option in the Maven > Archetypes to check which one is working
可以使用 Maven > Archetypes 中的“验证”选项来检查哪个正在工作