Jersey Maven quickstart archetype in Eclipse
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
Here's a quick walk-through of how to create the Jersey archetype in Eclipse
Go to
File
→New
→Other
In the dialog, select the
Maven
file theMaven Project
, then NextIn 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 Stackoverflow answer for how you can get the archetypes.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 NextIn the next dialog, enter the groupId, artifactId, and package, then hit 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.
See Also:
- Getting Started with Jersey 2
Eclipse java - How do I include Jersey archetype in Maven?
You need to add the Jersey Maven Archetype to your Eclipse because your catalog is not the lastest version.
Go to Preferences -> Maven -> Archetypes ->Add Remote Catalog and add these parameters:
Catalog File: http://repo1.maven.org/maven2/archetype-catalog.xml
Description: maven catalog
Note: Probably It's necesary to restart your Eclipse.
Unable to create new maven project using jersey-quickstart-webapp archetype
Add Java.net repo in your app:<project ...>
<repositories>
<repository>
<id>java.net</id>
<url>https://maven.java.net/content/repositories/public/</url>
</repository>
</repositories>
</project>
Create a Maven project in Eclipse complains Could not resolve archetype
I fixed this problem by following the solution to this other StackOverflow question
I had the same problem. I fixed it by adding the maven archetype catalog to eclipse. Steps are provided below: (Please note the https protocol)
- Open Window > Preferences
- Open Maven > Archetypes
- Click 'Add Remote Catalog' and add the following:
- Catalog File: https://repo1.maven.org/maven2/archetype-catalog.xml
- Description: maven catalog
Related Topics
Class.Getresource() Returns Null
Are Java Primitive Ints Atomic by Design or by Accident
What Are the Best Use Cases for Akka Framework
Spring Qualifier and Property Placeholder
How Is Length Implemented in Java Arrays
Jackson JSON Deserialization with Root Element
"The Public Type <<Classname>> Must Be Defined in Its Own File" Error in Eclipse
How to Read Request Body Multiple Times in Spring 'Handlermethodargumentresolver'
Jpanel Positions and Sizes Changes According to Screensize
Why Are Getter and Setter Method Important in Java
What's the Point of Guava's Optional Class
Jsoup Character Encoding Issue
Java: How to Access a Class's Field by a Name Stored in a Variable
Java Swing: How to Implement a Login Screen Before Showing a Jframe
How to Add an Extra Source Directory for Maven to Compile and Include in the Build Jar