On 12 Feb 2009, at 15:39, Lee Goddard wrote:
As Gérald said, you should keep your source and compiled
artifacts separate.
Oh yes, sounds like a very good idea. No argument from me!
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).
I can see the sense of that, just that it seems rather distribution-
dependant to me: I can more productive if I can regularly build a
distribution in situ.
This is why I added Tomcat to the subject line -- surely people
aren't copying files and directories around to make distributions?
Perhaps I should be looking at configuring my dev Tomcat to read
fromt eh Maven-ised project structure? That just seems feel.
I feel I am missing a vital piece of the puzzle, but no-one have
spoken to in the real world seems to have it -- possibly because
they rely on Eclipse and I don't, or perhaps because their jobs
involve installing distributions of the software, whereas mine
involves writing the software....
I think it is the case that most people who use Maven will be using a
Java IDE of some sort. These take care of ensuring that the right
files are seen by the web server at the right time.
Generally, though it's fairly normal (when outside of an IDE) to
package the software before letting tomcat (or any other servlet
container) at it.
If you really want tomcat to serve your files directly, you can
configure it (in conf/Catalina/localhost/myproj.xml) to point directly
at …/myproj/src/main/webapp. I'd say that this isn't a particularly
normal usage scenario though.
-Dom