Monday, 15 March 2010

java - Difficulties in developing a maven web project in eclipse -



java - Difficulties in developing a maven web project in eclipse -

i created maven web project through command line procedures. have m2e, wtp, tomcat plugins installed in eclipse indigo. imported project eclipse through m2e plugin. added these in maven settings.xml within <servers> node

<server> <id>tomcatserver</id> <username>admin</username> <password>adminadmin</password> </server>

in tomcat-users.xml have

<tomcat-users> <user name="admin" password="adminadmin" roles="admin-gui,manager-gui" /> </tomcat-users>

in pom.xml have

<build> <finalname>firstwebapp</finalname> <plugins> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>tomcat-maven-plugin</artifactid> <configuration> <server>tomcatserver</server> <path>/firstwebapp</path> </configuration> </plugin> </plugins> </build>

now right click on project -> run -> maven build

now didn't work. i.e. under run -> run on server alternative didn't appear.

right click on project -> properties -> project facets -> selected dynamic web module, java, javascript

maven built project itself. run on server appeared. when run application run index.jsp didn't appear in welcome-file-list of web.xml.

there reddish cross marked square appear on project. when clicked on error pages under deployment descriptor header says:

resource '/firstwebapp/webcontent/web-inf/web.xml' not exist.

actually not exist because when created maven project nowadays in

/src/main/webapp/web-inf/web.xml

and still nowadays there. index.jsp nowadays within webapp directory. where problem ? totally confused directory construction of maven web project. can please explain me directory construction of web project. here is:

->src ->main resources ->webapp index.jsp ->web-inf web.xml ->target -> it's sub-directories ->webcontent ->meta-inf ->web-inf lib

this giving me pretty headache. please guide me going right way develop maven web project in eclipse ?

and where should set pojos, servlets , other classes in structure.

thanks lot

if you're using 1 of more recent eclipse versions (indigo or juno), should install m2e-wtp plugin well. bridge between maven configuration , way wtp expects project layout.

http://www.eclipse.org/m2e-wtp/

this question looks similar you're trying do, explains in more detail how set project structure: maven/tomcat projects in eclipse indigo/3.7

java eclipse maven

No comments:

Post a Comment