• Post Reply Bookmark Topic Watch Topic
  • New Topic

RESTful web services starting project with maven

Mike Masters
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All

I'm quite new to Java and have taken an interest in web services, specifically RESTful web services. I have purchased the book RESTful Java with JAX-RS 2.0, 2nd Edition and have just started out.

My goal: The book uses Maven and doesn't really discuss working with any IDE, but I want to work with Eclipse. I don't want to just import the book's provided code, I want to work along side it.

I am able to import the books example code projects ok (I have m2eclipse) and run them like that, but I actually want to recreate the projects and write the code myself, which is where I am having trouble.

I believe I should be generating a new project in Maven and then just importing the Maven project into Eclipse to work with it.

I understand the basics about generating a project myself using Maven (i've gone through the JavaBrains Maven video tutorials as a warm up) and im guessing I need the archetypeArtifactId to be maven-archetype-webapp right? so I generate that and import it into eclipse (I guess I could have converted it into an eclipse project but I don't really see any benefit to to that). As soon as I import it, I have an error "Description Resource Path Location Type
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path index.jsp /shop/src/main/webapp line 1 JSP Problem"

This doesn't sound great, I've not even done anything yet and im getting errors! I look at the build path and it is referring to /shop/src/main/java (which doesn't exist), /shop/src/main/resources and /shop/src/test/java (also doesn't exist).

What am I doing wrong to start out with? Am I using the wrong archetypeArtifactId?

Also, how should I be deploying and testing my web service? I can get the example supplied code running using mvn jetty:run but is it also possible to just mvn package and then deploy the war to my tomcat server I setup in Eclipse?

I know it would be easier to just make an Eclipse project or to convert my Maven project to an Eclipse, but I want to align to the book which doesn't do any of this stuff and works just fine even after importing it as a Maven project.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!