0
votes

I'm using Eclipse IDE for EE development(Kepler SR1).

Using Maven 3.1.0, I'm trying to create a simple web project. Accordingly, in Eclipse, I select maven-archetype-webapp and proceed.

But when the project is created, under 'Java resources', only src/main/resources is seen. When I check the build path, it shows src/main/java and src/test/java as missing.

Obviously, when I created a simple servlet under src/main/resources, I got a ClassNotFoundException for the servlet - I believe that the Servlet class didn't get compiled as my Maven basic folder structure itself is missing !

What could be the problem? I don't see any reason to make/create any source folder entries manually if I'm getting the option of 'maven-archetype-webapp' in the Eclipse IDE.

1

1 Answers

0
votes

There's nothing in the documentation to suggest that the maven-archetype-webapp archetype will create a servlet class for you.

The documentation for this archetype shows this structure as the end result:

project
|-- pom.xml
`-- src
    `-- main
        `-- webapp
            |-- WEB-INF
            |   `-- web.xml
            `-- index.jsp

The archetype description does state that is a "An archetype which contains a sample Maven Webapp project.", and it certainly is.

You'll need to use another archetype, or create your own. An alternative approach is the Eclipse WTP integration to eclipse-ify your maven project. It's been a while since I tried, but iirc that worked pretty well.