You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Lee Goddard <le...@bbc.co.uk> on 2009/02/12 16:08:09 UTC

POM Best Practice? Tomcat, svn wc, and dists

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

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?

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.

Many thanks in anticipation

Lee Goddard



http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: POM Best Practice? Tomcat, svn wc, and dists

Posted by Gérald Quintana <ge...@gmail.com>.
Mixing source files (.java) and compiled (.class) is not a good idea.
Java source files should go into src/main/java folder
Gerald

2009/2/12 Lee Goddard <le...@bbc.co.uk>:
> 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?
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Tomcat, Ant and Maven (Was POM Best Practice? Tomcat, svn wc, and dists)

Posted by Lee Goddard <le...@bbc.co.uk>.
 
> have a look at the jetty:run and tomcat:run mojos... these 
> will package up the war files into a directory, start a jetty 
> or tomcat container respectively and serve the webapp in 
> place,  The jetty one supports scanning of the source files 
> and automatic reloading of the webapp... I think the tomcat 
> one might support the same, but I'm not sure.
> 
> These mojos make CLI development trivial IMHO

Great stuff, thank you! I'll check them out.

Lee
  

http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: mvn jetty home?

Posted by Deron Eriksson <jo...@codestrategies.com>.
There is a configuration guide here that can probably answer your questions:
http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin


You should be able to use the plugin by adding it to the
build->plugins->plugin section of your project's pom.xml, like:
<plugin>
   <groupId>org.mortbay.jetty</groupId>
   <artifactId>jetty-maven-plugin</artifactId>
   <version>7.0.0.pre5</version>
</plugin>

Versions of the plugin before 7 apparently use maven-jetty-plugin as the
artifact rather than jetty-maven-plugin:
<plugin>
   <groupId>org.mortbay.jetty</groupId>
   <artifactId>maven-jetty-plugin</artifactId>
   <version>6.1.14</version>
</plugin>

The configuration guide describes configuration/execution of the various
goals.

Good luck,
Deron Eriksson
Code Strategies

-- 
View this message in context: http://www.nabble.com/Maven-using-old-snapshot-poms--tp21977241p22048668.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: mvn jetty home?

Posted by Lee Meador <le...@leemeador.com>.
Try http://jetty.mortbay.com/jetty/maven-plugin/

-- Lee

On Fri, Feb 13, 2009 at 7:51 AM, Lee Goddard <le...@bbc.co.uk> wrote:

> Could someone please point me to the Maven Jetty home and/or help me
> istall it?
>
> http://mojo.codehaus.org/jetty-maven-plugin/index.html says little, but
> when I follow those few instructions, I get the below error.
>
> Also,it refers to the deprecated "m2" command - is Jetty alive and well
> or should I be using something else?
>
> Thanks in anticipation
> Lee
>
>
> [INFO] Scanning for projects...
> [INFO] Searching repository for plugin with prefix: 'jetty'.
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] The plugin 'org.codehaus.mojo:jetty-maven-plugin' does not exist
> or no valid version could be found
> [INFO]
> ------------------------------------------------------------------------
> [INFO] For more information, run Maven with the -e switch
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: < 1 second
> [INFO] Finished at: Fri Feb 13 13:49:27 GMT 2009
> [INFO] Final Memory: 4M/254M
> [INFO]
> ------------------------------------------------------------------------
>
> http://www.bbc.co.uk/
> This e-mail (and any attachments) is confidential and may contain personal
> views which are not the views of the BBC unless specifically stated.
> If you have received it in error, please delete it from your system.
> Do not use, copy or disclose the information in any way nor act in reliance
> on it and notify the sender immediately.
> Please note that the BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
-- Lee Meador
Sent from gmail. My real email address is lee AT leemeador.com

mvn jetty home?

Posted by Lee Goddard <le...@bbc.co.uk>.
Could someone please point me to the Maven Jetty home and/or help me
istall it?

http://mojo.codehaus.org/jetty-maven-plugin/index.html says little, but
when I follow those few instructions, I get the below error.

Also,it refers to the deprecated "m2" command - is Jetty alive and well
or should I be using something else?

Thanks in anticipation
Lee


[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'jetty'.
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] The plugin 'org.codehaus.mojo:jetty-maven-plugin' does not exist
or no valid version could be found
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Fri Feb 13 13:49:27 GMT 2009
[INFO] Final Memory: 4M/254M
[INFO]
------------------------------------------------------------------------

http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Tomcat, Ant and Maven (Was POM Best Practice? Tomcat, svn wc, and dists)

Posted by Stephen Connolly <st...@gmail.com>.
have a look at the jetty:run and tomcat:run mojos... these will
package up the war files into a directory, start a jetty or tomcat
container respectively and serve the webapp in place,  The jetty one
supports scanning of the source files and automatic reloading of the
webapp... I think the tomcat one might support the same, but I'm not
sure.

These mojos make CLI development trivial IMHO

2009/2/13 Lee Goddard <le...@bbc.co.uk>:
>> 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.
>
> I feared as much.
>
>
>> 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.
>
> But not during development, surely? When actually writing the files?
>
>> 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.
>
> So I'll probably try to avoid it.
>
> Thanks for your help.
>
> I got the impression that Maven is intended to be used from the start of
> coding on a project, but it doesn't seem to sit very well with
> non-IDE-based development.
>
> Is there no parallel case in Maven for the Ant model of copying files
> from a source tree to a build location, as outlined in the Tomcat
> Developer's Guide on the Apache Tomat homepage?
>
> http://tomcat.apache.org/tomcat-6.0-doc/appdev/processes.html
>
> Thanks again,
> Lee
>
> http://www.bbc.co.uk/
> This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
> If you have received it in error, please delete it from your system.
> Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
> Please note that the BBC monitors e-mails sent or received.
> Further communication will signify your consent to this.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Tomcat, Ant and Maven (Was POM Best Practice? Tomcat, svn wc, and dists)

Posted by Lee Goddard <le...@bbc.co.uk>.
> 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.

I feared as much.


> 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.

But not during development, surely? When actually writing the files?
 
> 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.

So I'll probably try to avoid it.

Thanks for your help.

I got the impression that Maven is intended to be used from the start of
coding on a project, but it doesn't seem to sit very well with
non-IDE-based development. 

Is there no parallel case in Maven for the Ant model of copying files
from a source tree to a build location, as outlined in the Tomcat
Developer's Guide on the Apache Tomat homepage?

http://tomcat.apache.org/tomcat-6.0-doc/appdev/processes.html

Thanks again,
Lee

http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: POM Best Practice? Tomcat, svn wc, and dists

Posted by Dominic Mitchell <do...@semantico.com>.
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

RE: POM Best Practice? Tomcat, svn wc, and dists

Posted by Lee Goddard <le...@bbc.co.uk>.
Thanks, Dominic and Gérald,

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

I hear even a bed of nails can be comfortable if you get used to it... :)


> 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.... 


> 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.

Thanks, I have been reading that in tandem with posting here. I'm currently looking at sourceDirectory....

Thanks again, to both of you.

Lee

http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
					

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: POM Best Practice? Tomcat, svn wc, and dists

Posted by Dominic Mitchell <do...@semantico.com>.
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