2016/03/21

Create a JAX-RS maven project and import it into Eclipse

See updated instructions here in this other post

The following instructions work but are Not Recommended since modifying the pom.xml would be useless since those modifications will not be reflected in Eclipse project :(
  1. Create the skeleton
    Instructions taken from Stackoverflow - Maven 3 failed to execute goal apache ...
    mvn archetype:generate \
        -DgroupId={project-packaging} \
        -DartifactId={project-name} \
        -DarchetypeArtifactId=maven-archetype-webapp \
        -DinteractiveMode=false
    
    That will create a {project-name} directory with the contents:
    .
    ├── pom.xml
    └── src
        └── main
            ├── java (This directory will contain all the source code, must be created manually)
            ├── resources
            └── webapp
                ├── WEB-INF
                │   └── web.xml
                └── index.jsp
    
  2. Import it into eclipse
    FileImportExisting Projects into Workspace and then select {project-name} directory. Once imported, go to project properties and do the following settings:
    1. Setup the facets
      Instructions taken from this article from OPENTONE and adapted for my needs
      • Java 1.8
      • Dynamic Web Project 3.1
      • JAX-RS 2.0
      • Javascript will be selected automatically later. It is not necessary to explicitly select it here
    2. Setup the target runtime
      Select "WebSphere Liberty Profile"

0 comments :