I am trying to create Jersey normally with the aid of maven but I am always getting this structure as in the scrennshoot and without error as normally?! It does not look as Jersey commonly layout.
我试图通过maven的帮助正常创建泽西但是我总是像scrennshoot一样得到这个结构并且通常没有错误?!它看起来不像泽西岛常见的布局。
I am using this one:
我正在使用这个:
org.glassfish.jersey.archetypes
jersey-quickstart-webapp
2.16
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>serverSide</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>serverSide</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
3 个解决方案
#1
I highly doubt you are creating the archetype project correctly. What you are showing is a product of the org.apache.maven.archetypes : maven-archetype-quickstart
我非常怀疑你是否正确地创建了原型项目。你展示的是org.apache.maven.archetypes的产品:maven-archetype-quickstart
Here's a quick walk-through of how to create the Jersey archetype in Eclipse
以下是如何在Eclipse中创建Jersey原型的快速演练
-
Go to
File
→New
→Other
转到文件→新建→其他
-
In the dialog, select the
Maven
file theMaven Project
, then Next在对话框中,选择Maven项目Maven项目,然后选择Next
-
In the next dialog keep all the defaults, and hit Next
在下一个对话框中保留所有默认值,然后单击“下一步”
-
In this next dialog we will select the Maven archetype. In the search box, type
jersey-quickstart-webapp
. All the archetypes takes a few moments to load. You can see the progress at the bottom right of the IDE is they are still loading. This shouldn't take more than maybe 5 seconds. If you are not seeing any results come up from the search, then it's likely you don't have the archetypes installed. See this * answer for how you can get the archetypes.在下一个对话框中,我们将选择Maven原型。在搜索框中,键入jersey-quickstart-webapp。所有的原型需要一些时间来加载。您可以看到IDE右下角的进度是否仍在加载。这不应该花费超过5秒钟。如果您没有看到搜索结果,那么您可能没有安装原型。请参阅此*答案,了解如何获取原型。
Once the archetypes load, and you see the
jersey-quickstart-webapp
in the results list, uncheck "Show the last version of Archetype only". So once you have unchecked that, you should see more version available. Scroll down to theorg.glassfish.jersey.archetypes
and select the version 2.16 (or whatever the latest version is, if you choose). Then hit Next加载原型后,在结果列表中看到jersey-quickstart-webapp,取消选中“仅显示Archetype的最新版本”。因此,一旦取消选中,您应该会看到更多可用版本。向下滚动到org.glassfish.jersey.archetypes并选择版本2.16(如果您选择,则选择最新版本)。然后点击Next
-
In the next dialog, enter the groupId, artifactId, and package, then hit Finish
在下一个对话框中,输入groupId,artifactId和package,然后单击Finish
-
You should now see a project with the following structure. There will be an error in the project because of you jsp page. We have no use for it here, so you can delete it if you want. This should get rid of the error.
您现在应该看到具有以下结构的项目。由于你的jsp页面,项目中会出错。我们在这里没有用,所以你可以删除它。这应该摆脱错误。
See Also:
#2
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 * answer, try to complete the following steps in eclipse:
然后在使用此*答案中指定的解决方案进行处理之前,尝试在eclipse中完成以下步骤:
Steps:
- Go to Eclipse Help -> Install New Software...
- Enter "http://download.eclipse.org/technology/m2e/releases" inside Work with field and click on Add button.
- Give any name. For example "remote archetypes" and click on OK button.
- Then click on Select All button.
- click Next button two times.
- Accept the licence and install the updated maven.
转到Eclipse帮助 - >安装新软件...
在Work with字段中输入“http://download.eclipse.org/technology/m2e/releases”,然后单击“添加”按钮。
给出任何名字。例如“远程原型”,然后单击“确定”按钮。
然后单击“全选”按钮。
单击“下一步”按钮两次。
接受许可并安装更新的maven。
#3
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
To resolve the issues with respect to archetypes while creating a new maven project ,please follow the same.
要在创建新的maven项目时解决有关原型的问题,请遵循相同的规则。
Navigate as follows in your Eclipse IDE,
在Eclipse IDE中按如下方式导航,
Hover to windows-->Click on Preferences
将鼠标悬停在窗口 - >单击“首选项”
Search for maven and select Archetype(first option under the hood as in screen shot)
搜索maven并选择Archetype(引擎盖下的第一个选项,如屏幕截图)
-
Click on Add Remote catalog on the same
单击添加远程目录
-
In catalog file text box,Enter the following: http://repo.maven.apache.org/maven2/archetype-catalog.xml
在目录文件文本框中,输入以下内容:http://repo.maven.apache.org/maven2/archetype-catalog.xml
This above URL could be changed in future;in that case please refer the below link under location of catalog files for latest URL http://maven.apache.org/archetype/maven-archetype-plugin/specification/archetype-catalog.html
以上URL可以在以后更改;在这种情况下,请参阅目录文件位置下面的链接以获取最新的URL http://maven.apache.org/archetype/maven-archetype-plugin/specification/archetype-catalog.html
- Under Description,enter your own description of choice & click ok & apply the main menu.
在描述下,输入您自己的选择说明并单击确定并应用主菜单。
Give eclipse sometime to load your archetypes.(Check progress menu for the download status)
有时候给eclipse加载你的原型。(检查下载状态的进度菜单)
And this worked out for me. Thanks
这对我来说很有用。谢谢
#1
I highly doubt you are creating the archetype project correctly. What you are showing is a product of the org.apache.maven.archetypes : maven-archetype-quickstart
我非常怀疑你是否正确地创建了原型项目。你展示的是org.apache.maven.archetypes的产品:maven-archetype-quickstart
Here's a quick walk-through of how to create the Jersey archetype in Eclipse
以下是如何在Eclipse中创建Jersey原型的快速演练
-
Go to
File
→New
→Other
转到文件→新建→其他
-
In the dialog, select the
Maven
file theMaven Project
, then Next在对话框中,选择Maven项目Maven项目,然后选择Next
-
In the next dialog keep all the defaults, and hit Next
在下一个对话框中保留所有默认值,然后单击“下一步”
-
In this next dialog we will select the Maven archetype. In the search box, type
jersey-quickstart-webapp
. All the archetypes takes a few moments to load. You can see the progress at the bottom right of the IDE is they are still loading. This shouldn't take more than maybe 5 seconds. If you are not seeing any results come up from the search, then it's likely you don't have the archetypes installed. See this * answer for how you can get the archetypes.在下一个对话框中,我们将选择Maven原型。在搜索框中,键入jersey-quickstart-webapp。所有的原型需要一些时间来加载。您可以看到IDE右下角的进度是否仍在加载。这不应该花费超过5秒钟。如果您没有看到搜索结果,那么您可能没有安装原型。请参阅此*答案,了解如何获取原型。
Once the archetypes load, and you see the
jersey-quickstart-webapp
in the results list, uncheck "Show the last version of Archetype only". So once you have unchecked that, you should see more version available. Scroll down to theorg.glassfish.jersey.archetypes
and select the version 2.16 (or whatever the latest version is, if you choose). Then hit Next加载原型后,在结果列表中看到jersey-quickstart-webapp,取消选中“仅显示Archetype的最新版本”。因此,一旦取消选中,您应该会看到更多可用版本。向下滚动到org.glassfish.jersey.archetypes并选择版本2.16(如果您选择,则选择最新版本)。然后点击Next
-
In the next dialog, enter the groupId, artifactId, and package, then hit Finish
在下一个对话框中,输入groupId,artifactId和package,然后单击Finish
-
You should now see a project with the following structure. There will be an error in the project because of you jsp page. We have no use for it here, so you can delete it if you want. This should get rid of the error.
您现在应该看到具有以下结构的项目。由于你的jsp页面,项目中会出错。我们在这里没有用,所以你可以删除它。这应该摆脱错误。
See Also:
#2
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 * answer, try to complete the following steps in eclipse:
然后在使用此*答案中指定的解决方案进行处理之前,尝试在eclipse中完成以下步骤:
Steps:
- Go to Eclipse Help -> Install New Software...
- Enter "http://download.eclipse.org/technology/m2e/releases" inside Work with field and click on Add button.
- Give any name. For example "remote archetypes" and click on OK button.
- Then click on Select All button.
- click Next button two times.
- Accept the licence and install the updated maven.
转到Eclipse帮助 - >安装新软件...
在Work with字段中输入“http://download.eclipse.org/technology/m2e/releases”,然后单击“添加”按钮。
给出任何名字。例如“远程原型”,然后单击“确定”按钮。
然后单击“全选”按钮。
单击“下一步”按钮两次。
接受许可并安装更新的maven。
#3
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
To resolve the issues with respect to archetypes while creating a new maven project ,please follow the same.
要在创建新的maven项目时解决有关原型的问题,请遵循相同的规则。
Navigate as follows in your Eclipse IDE,
在Eclipse IDE中按如下方式导航,
Hover to windows-->Click on Preferences
将鼠标悬停在窗口 - >单击“首选项”
Search for maven and select Archetype(first option under the hood as in screen shot)
搜索maven并选择Archetype(引擎盖下的第一个选项,如屏幕截图)
-
Click on Add Remote catalog on the same
单击添加远程目录
-
In catalog file text box,Enter the following: http://repo.maven.apache.org/maven2/archetype-catalog.xml
在目录文件文本框中,输入以下内容:http://repo.maven.apache.org/maven2/archetype-catalog.xml
This above URL could be changed in future;in that case please refer the below link under location of catalog files for latest URL http://maven.apache.org/archetype/maven-archetype-plugin/specification/archetype-catalog.html
以上URL可以在以后更改;在这种情况下,请参阅目录文件位置下面的链接以获取最新的URL http://maven.apache.org/archetype/maven-archetype-plugin/specification/archetype-catalog.html
- Under Description,enter your own description of choice & click ok & apply the main menu.
在描述下,输入您自己的选择说明并单击确定并应用主菜单。
Give eclipse sometime to load your archetypes.(Check progress menu for the download status)
有时候给eclipse加载你的原型。(检查下载状态的进度菜单)
And this worked out for me. Thanks
这对我来说很有用。谢谢