Hi, Lee!

On 12 Feb 2009, at 15:08, Lee Goddard wrote:

I am a new user of Maven, but have some experience of building Perl and
C distributions.

I hesitate to draw comparisons between maven and ExtUtils::MakeMaker. :-)

I have a simple Tomcat Servlet project checked into SVN just as it sits
in Tomcats default webapp/ dir:

My_project /
   WEB-INF /
       classes /
               my_company/
                       my_library.java
       lib/
               my_depends.jar
       web.xml

I've been asked to copy and paste those into the structure produced by
the default maven archetype (if the terms are right).

I think I understand that My_project/WEB-INF/lib will become Maven
dependencies.

Is it possible to set my POM to use build/sourceDirectory to point to
My_pojrect/WEB-INF/classes?

Would that be a bad idea?  Is it frequently/never done that way?


As Gérald said, you should keep your source and compiled artifacts separate. The maven standard (which seems reasonable to me) is that java source code lives under src/main/java. Additional non-java files you want to end up in your classpath (i.e. WEB-INF/classes) go into src/main/resources. When you run "mvn package" everything will get copied into place, then packaged up into target/myproject-0.1.war (or similar).

Whilst you can make maven look in other places for the source code, it's usually better in the long run to stick with the defaults. Once you've got a couple of projects with similar structures, it makes moving between them much easier.

All thoughts or directions to the manuals appreciated. I am sure this
must be covered somewhere, but I am asking your help to try to get
up-and-running with Maven as quickly as possible.


Probably your best bet for now is to check out the online edition of Maven: The Definitive Guide. There's a lot in there, but the first few chapters should get you over the hump fairly quickly.

-Dom

Reply via email to