You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Malcolm Warren <ma...@villeinitalia.com> on 2010/10/17 16:46:17 UTC

Maven and Tomcat and Eclipse

  Dear All,

I've spent three days reading two books about Maven, all of the Maven 
site, and finally searching the web for hours.
But unfortunately I seem unable to work out and understand one simple 
concept and I've reached the end of my tether. Hope somebody can help!

I've successfully moved a small application from using Ant to Maven, 
using the default Maven folder structure.
And Maven does a lovely job of compiling it.

But what I just can't work out is where do I (the developer) and Tomcat 
fit into all of this now?

-------------

I have a nice myapp/appSrc/src/main/java folder containing all if my 
source for the app
and another myapp/appWeb/src/main/webapp folder containing the web files.
And with a parent .pom and two child .poms exactly as recommended on the 
maven site, maven compiles my source, places it in a .jar file in the 
repository and into the target WEB-INF/lib folder along with all the 
dependencies.

But what next? Where do I work?

-------------

In the original Ant setup Ant would compile my source files and place 
them in the -original- webapp/WEB-INF/lib folder, so that is where 
Tomcat comes in - picking up the app from the original webapp folder.

But with Maven I can no longer work in the original webapp folder, 
because now everything gets copied into the target, and that is where I 
find the .jar file and all its dependencies - in the target folders.
So I could set up Tomcat to work in the target folder I suppose and 
there I start developing. But wait a minute, if I want to change a 
sentence in a .jsp file, let's say, and see the result, how do I go 
about that?
I can't work in the target folder because everything gets copied from 
the original folder and it would get written over, but I can't work in 
Tomcat from the original folder either because the .jar file and its 
dependencies aren't there.

???

Ok so now I've found all over the web references to the tomcat Maven 
plug-in which, using the Manager app, deploys and can later redeploy 
your app to Tomcat.
But that doesn't make much sense to me either. Is that the route I have 
to go down?
Because if so, we're saying that for every tiddly little change to a 
.jsp file while developing I have to run a maven install followed by a 
redeploy, which doesn't seem to make much sense.

I must be missing something here.


I'd be very grateful for any help to get me moving the right direction 
again.
Thanks for listening.

--------------
At the moment my Tomcat server is independent of Eclipse, I don't use 
the internal tomcat possibilities, I see that Maven can run a Tomcat as 
well.
I'd prefer to remain with my independent version if possible as I have 
four other apps that will eventually have to be moved to Maven as well.

Malcolm










Re: Maven and Tomcat and Eclipse

Posted by Ognjen Blagojevic <og...@gmail.com>.
Here is how I use it:

1. Eclipse EE with WTP
2. Tomcat installed form .zip archive
3. Tomcat registered in Eclipse at Server view (allows clean deploy, 
incremental deploy, restart and debug)
4. m2eclipse plug-in (allows pom.xml -> Eclipse dependency configuration)

It copies jsp files to Tomcat webapp folder moment after you save it, 
most of the time you won't notice delay.

It copies class file from webapp project to Tomcat webapp folder moment 
after you build it. It takes some more (5-15 sec) for Tomcat to restart 
context.

It copies jar files from dependent project to Tomcat webapp folder few 
seconds after you build it (time needed to pack the .jar file), and 
again same time for context restart.

It copies .xml configuration files to Tomcat webapp folder moment after 
you save them, but for some of them (e.g. web.xml) you need to restart 
Tomcat for changes to have effect.

Having said that, I would love if:

1. Tomcat could reload classes without context restart
2. Tomcat + WTP could allow in-place context deployment (without copying 
anything, just setting up appropriate webapp classpath)

Maybe it is already possible, but I wouldn't know how to set-up that.

-Ognjen


On 17.10.2010 16:46, Malcolm Warren wrote:
> Dear All,
>
> I've spent three days reading two books about Maven, all of the Maven
> site, and finally searching the web for hours.
> But unfortunately I seem unable to work out and understand one simple
> concept and I've reached the end of my tether. Hope somebody can help!
>
> I've successfully moved a small application from using Ant to Maven,
> using the default Maven folder structure.
> And Maven does a lovely job of compiling it.
>
> But what I just can't work out is where do I (the developer) and Tomcat
> fit into all of this now?
>
> -------------
>
> I have a nice myapp/appSrc/src/main/java folder containing all if my
> source for the app
> and another myapp/appWeb/src/main/webapp folder containing the web files.
> And with a parent .pom and two child .poms exactly as recommended on the
> maven site, maven compiles my source, places it in a .jar file in the
> repository and into the target WEB-INF/lib folder along with all the
> dependencies.
>
> But what next? Where do I work?
>
> -------------
>
> In the original Ant setup Ant would compile my source files and place
> them in the -original- webapp/WEB-INF/lib folder, so that is where
> Tomcat comes in - picking up the app from the original webapp folder.
>
> But with Maven I can no longer work in the original webapp folder,
> because now everything gets copied into the target, and that is where I
> find the .jar file and all its dependencies - in the target folders.
> So I could set up Tomcat to work in the target folder I suppose and
> there I start developing. But wait a minute, if I want to change a
> sentence in a .jsp file, let's say, and see the result, how do I go
> about that?
> I can't work in the target folder because everything gets copied from
> the original folder and it would get written over, but I can't work in
> Tomcat from the original folder either because the .jar file and its
> dependencies aren't there.
>
> ???
>
> Ok so now I've found all over the web references to the tomcat Maven
> plug-in which, using the Manager app, deploys and can later redeploy
> your app to Tomcat.
> But that doesn't make much sense to me either. Is that the route I have
> to go down?
> Because if so, we're saying that for every tiddly little change to a
> .jsp file while developing I have to run a maven install followed by a
> redeploy, which doesn't seem to make much sense.
>
> I must be missing something here.
>
>
> I'd be very grateful for any help to get me moving the right direction
> again.
> Thanks for listening.
>
> --------------
> At the moment my Tomcat server is independent of Eclipse, I don't use
> the internal tomcat possibilities, I see that Maven can run a Tomcat as
> well.
> I'd prefer to remain with my independent version if possible as I have
> four other apps that will eventually have to be moved to Maven as well.
>
> Malcolm
>
>
>
>
>
>
>
>
>
>


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


Re: Maven and Tomcat and Eclipse

Posted by Malcolm Warren <ma...@villeinitalia.com>.
  Nobody's answered this, but perhaps this shouldn't really be in this 
mailing list. I'll try with a maven list.
This problem is closed.

Thanks

Il 17/10/10 16.46, Malcolm Warren ha scritto:
>  Dear All,
>
> I've spent three days reading two books about Maven, all of the Maven 
> site, and finally searching the web for hours.
> But unfortunately I seem unable to work out and understand one simple 
> concept and I've reached the end of my tether. Hope somebody can help!
>
> I've successfully moved a small application from using Ant to Maven, 
> using the default Maven folder structure.
> And Maven does a lovely job of compiling it.
>
> But what I just can't work out is where do I (the developer) and 
> Tomcat fit into all of this now?
>
> -------------
>
> I have a nice myapp/appSrc/src/main/java folder containing all if my 
> source for the app
> and another myapp/appWeb/src/main/webapp folder containing the web files.
> And with a parent .pom and two child .poms exactly as recommended on 
> the maven site, maven compiles my source, places it in a .jar file in 
> the repository and into the target WEB-INF/lib folder along with all 
> the dependencies.
>
> But what next? Where do I work?
>
> -------------
>
> In the original Ant setup Ant would compile my source files and place 
> them in the -original- webapp/WEB-INF/lib folder, so that is where 
> Tomcat comes in - picking up the app from the original webapp folder.
>
> But with Maven I can no longer work in the original webapp folder, 
> because now everything gets copied into the target, and that is where 
> I find the .jar file and all its dependencies - in the target folders.
> So I could set up Tomcat to work in the target folder I suppose and 
> there I start developing. But wait a minute, if I want to change a 
> sentence in a .jsp file, let's say, and see the result, how do I go 
> about that?
> I can't work in the target folder because everything gets copied from 
> the original folder and it would get written over, but I can't work in 
> Tomcat from the original folder either because the .jar file and its 
> dependencies aren't there.
>
> ???
>
> Ok so now I've found all over the web references to the tomcat Maven 
> plug-in which, using the Manager app, deploys and can later redeploy 
> your app to Tomcat.
> But that doesn't make much sense to me either. Is that the route I 
> have to go down?
> Because if so, we're saying that for every tiddly little change to a 
> .jsp file while developing I have to run a maven install followed by a 
> redeploy, which doesn't seem to make much sense.
>
> I must be missing something here.
>
>
> I'd be very grateful for any help to get me moving the right direction 
> again.
> Thanks for listening.
>
> --------------
> At the moment my Tomcat server is independent of Eclipse, I don't use 
> the internal tomcat possibilities, I see that Maven can run a Tomcat 
> as well.
> I'd prefer to remain with my independent version if possible as I have 
> four other apps that will eventually have to be moved to Maven as well.
>
> Malcolm
>
>
>
>
>
>
>
>
>
>


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