Search code examples
mavenarchetypes

Add Archtypes to Eclipse


I am new to MAVEN and restful services. I have MAVEN installed it correctly and set the variables. I was creating a webservice using the jersey-quickstart-webapp but found it did not appeared in the list of Archetypes. I tried to add it using using ADD Archetypes option. After the entering the details

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>

Solution

  • I don't have a ready explanation as to why the Eclipse archetype plugin was giving you this error, since 2.16 is a valid version of jersey-quickstart-webapp. However, I would recommend that you try manually executing the following command from a command prompt:

    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
    

    Make sure that you first delete the jersey-quickstart-webapp folder, if it exists, from your Maven .m2 directory. This may be necessary to avoid from something getting corrupted during the archetype install.

    Here is a link to the official documentation for creating a Jersey EE application from a Maven archetype.