facebook

integrating maven with webapps

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #282970 Reply

    stiggs
    Member

    This message has not been recovered.

    #282989 Reply

    Loyal Water
    Member

    This message has not been recovered.

    #285903 Reply

    benjwarner
    Member

    Thanks very much for your post.

    I’ve been running maven2 setup in myeclipse. I’m having the problem whereby if my source output folder is /src/main/webapp/WEB-INF/classes, my tomcat runs well with hot deployment etc, but my JUnit tests don’t work, as they are expecting classes to be in /target/classes. But if I set my output folder as /target/classes, my JUnit tests work, but my tomcat deployment breaks because of an empty WEB-INF/classes directory.

    One way around it is to configure each tests, and add to test’s classpath, the WEB-INF/classes directory, but this is a pain if I’m running and writing a lot of tests.

    Have you come accross this problem before? I’d like to get it setup so that both JUnit and the tomcat deploy both work off the same classes folder, preferably target/classes.

    Any advice would be appreciated.

    #285904 Reply

    benjwarner
    Member

    OK, I’ve found a solution that will do for now.

    In my project build paths, I have my src/main/java directory outputting to /target/classes, and my src/test/java outputting to /target/test-classes. In my .classpath file I’ve put in two output directories.

    <classpathentry kind=”output” path=”target/classes”/>
    <classpathentry kind=”output” path=”src/main/webapp/WEB-INF/classes”/>

    This seems to work. It gives tomcat a build of classes for deployment, and it gives JUnit and everything else, classes in the standard maven output folder.

    If there is any other “cleaner” way which does not involve using two output directories, I’d be very keen to hear it.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: integrating maven with webapps

You must be logged in to post in the forum log in