Running tomcat maven plugin in a multi modules project

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Running tomcat maven plugin in a multi modules project

Sigmond Hola
I have a multi-module project like this:

ROOT:pom
    --- web:war
    --- domain:jar
    --- service:jar
    --- dao:jar

And i configure tomcat7-maven-plugin in pom.xml of module *web *so that I
can using tomcat:run to run this web application.

But if I change something in other module, for example, add a new entity
class in module domain, I have to install the ROOT to local repo first
before I run tomcat:run within module web, otherwise a error: cannot find
symbol will be reported if I run tomcat:run directly.

So how can I install other modules first before I run tomcat:run within
module web if I change something in other modules?

Thanks in advance.

Best regards.
Reply | Threaded
Open this post in threaded view
|

Re: Running tomcat maven plugin in a multi modules project

mgainty
MG>knowing you're not going to find your artifacts in any of maven repositories you will need to deploy local repo
MG>look at the Tomcat autodeploy feature for any changes to war to 'autodeploy' to specified location (which in TC is MG>webapps folder but for maven-plugin you will <auto>deploy to your local repo)

MG>if you could clone project to github and share the link we could more closely track any errors you are experiencing


________________________________
From: Sigmond Hola <[hidden email]>
Sent: Friday, January 12, 2018 9:33 PM
To: [hidden email]
Subject: Running tomcat maven plugin in a multi modules project

I have a multi-module project like this:

ROOT:pom
    --- web:war
    --- domain:jar
    --- service:jar
    --- dao:jar

And i configure tomcat7-maven-plugin in pom.xml of module *web *so that I
can using tomcat:run to run this web application.

But if I change something in other module, for example, add a new entity
class in module domain, I have to install the ROOT to local repo first
before I run tomcat:run within module web, otherwise a error: cannot find
symbol will be reported if I run tomcat:run directly.

So how can I install other modules first before I run tomcat:run within
module web if I change something in other modules?

Thanks in advance.

Best regards.
Reply | Threaded
Open this post in threaded view
|

Re: Running tomcat maven plugin in a multi modules project

Thomas Broyer-2
In reply to this post by Sigmond Hola
Tomcat Maven plugin has built-in support for reactors, so run it at root
rather than within the web submodule (possibly with "-pl web -am"). It will
automatically compile all (needed) submodules and launch Tomcat, and with
auto-deploy will automatically reload the webapp to pickup changes in any
submodule.

Le sam. 13 janv. 2018 03:33, Sigmond Hola <[hidden email]> a écrit :

> I have a multi-module project like this:
>
> ROOT:pom
>     --- web:war
>     --- domain:jar
>     --- service:jar
>     --- dao:jar
>
> And i configure tomcat7-maven-plugin in pom.xml of module *web *so that I
> can using tomcat:run to run this web application.
>
> But if I change something in other module, for example, add a new entity
> class in module domain, I have to install the ROOT to local repo first
> before I run tomcat:run within module web, otherwise a error: cannot find
> symbol will be reported if I run tomcat:run directly.
>
> So how can I install other modules first before I run tomcat:run within
> module web if I change something in other modules?
>
> Thanks in advance.
>
> Best regards.
>
Reply | Threaded
Open this post in threaded view
|

Re: Running tomcat maven plugin in a multi modules project

mgainty
In reply to this post by mgainty

MG>this is a helpful link to implement "deploy your war to Tomcat via tomcat-maven-plugin"

https://www.mkyong.com/maven/how-to-deploy-maven-based-war-file-to-tomcat/

How to deploy Maven based war file to Tomcat - Mkyong<https://www.mkyong.com/maven/how-to-deploy-maven-based-war-file-to-tomcat/>
www.mkyong.com
In this tutorial, we will show you how to use Maven-Tomcat plugin to package and deploy a WAR file to Tomcat, both in Tomcat 6 and 7. This example shows you how to ...

MG>this *assumes* uptodate artifact jars from <dependencies> are pre-installed to repository(your local repository)



________________________________
From: Martin Gainty <[hidden email]>
Sent: Friday, January 12, 2018 10:05 PM
To: Maven Users List
Subject: Re: Running tomcat maven plugin in a multi modules project


MG>knowing you're not going to find your artifacts in any of maven repositories you will need to deploy local repo
MG>look at the Tomcat autodeploy feature for any changes to war to 'autodeploy' to specified location (which in TC is MG>webapps folder but for maven-plugin you will <auto>deploy to your local repo)

MG>if you could clone project to github and share the link we could more closely track any errors you are experiencing


________________________________
From: Sigmond Hola <[hidden email]>
Sent: Friday, January 12, 2018 9:33 PM
To: [hidden email]
Subject: Running tomcat maven plugin in a multi modules project

I have a multi-module project like this:

ROOT:pom
    --- web:war
    --- domain:jar
    --- service:jar
    --- dao:jar

And i configure tomcat7-maven-plugin in pom.xml of module *web *so that I
can using tomcat:run to run this web application.

But if I change something in other module, for example, add a new entity
class in module domain, I have to install the ROOT to local repo first
before I run tomcat:run within module web, otherwise a error: cannot find
symbol will be reported if I run tomcat:run directly.

So how can I install other modules first before I run tomcat:run within
module web if I change something in other modules?

Thanks in advance.

Best regards.
Reply | Threaded
Open this post in threaded view
|

Re: Running tomcat maven plugin in a multi modules project

Thomas Broyer-2
In reply to this post by Thomas Broyer-2
On Sat, Jan 13, 2018 at 3:20 PM Thomas Broyer <[hidden email]> wrote:

> Tomcat Maven plugin has built-in support for reactors, so run it at root
> rather than within the web submodule (possibly with "-pl web -am"). It will
> automatically compile all (needed) submodules and launch Tomcat, and with
> auto-deploy will automatically reload the webapp to pickup changes in any
> submodule.
>

From https://tomcat.apache.org/maven-plugin-2.2/run-mojo-features.html
> NOTE If you have a multi module Maven project and use Maven3,
> you don't need to install all modules before using the run goal, just
> use tomcat6/7:run from the root module and the plugin will auto
> detect the build output directory from various modules and replace
> dependencies with those directories in the webapp classloader.

(too bad there's been no new release for 4 years though, this is probably
one of the best thought-out Maven plugin out there in terms of usability
wrt multi-module projects, and without being "hackish"; without that,
people keep having to install all their snapshots into their local repo and
rebuilding them over and over again, if only to make sure they're the ones
for the correct commit / code state)


> Le sam. 13 janv. 2018 03:33, Sigmond Hola <[hidden email]> a
> écrit :
>
>> I have a multi-module project like this:
>>
>> ROOT:pom
>>     --- web:war
>>     --- domain:jar
>>     --- service:jar
>>     --- dao:jar
>>
>> And i configure tomcat7-maven-plugin in pom.xml of module *web *so that I
>> can using tomcat:run to run this web application.
>>
>> But if I change something in other module, for example, add a new entity
>> class in module domain, I have to install the ROOT to local repo first
>> before I run tomcat:run within module web, otherwise a error: cannot find
>> symbol will be reported if I run tomcat:run directly.
>>
>> So how can I install other modules first before I run tomcat:run within
>> module web if I change something in other modules?
>>
>> Thanks in advance.
>>
>> Best regards.
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Running tomcat maven plugin in a multi modules project

olamy
Hi,
Well to be fair Jetty Maven Plugin has now this feature as well...

On 14 January 2018 at 03:25, Thomas Broyer <[hidden email]> wrote:

> On Sat, Jan 13, 2018 at 3:20 PM Thomas Broyer <[hidden email]> wrote:
>
> > Tomcat Maven plugin has built-in support for reactors, so run it at root
> > rather than within the web submodule (possibly with "-pl web -am"). It
> will
> > automatically compile all (needed) submodules and launch Tomcat, and with
> > auto-deploy will automatically reload the webapp to pickup changes in any
> > submodule.
> >
>
> From https://tomcat.apache.org/maven-plugin-2.2/run-mojo-features.html
> > NOTE If you have a multi module Maven project and use Maven3,
> > you don't need to install all modules before using the run goal, just
> > use tomcat6/7:run from the root module and the plugin will auto
> > detect the build output directory from various modules and replace
> > dependencies with those directories in the webapp classloader.
>
> (too bad there's been no new release for 4 years though, this is probably
> one of the best thought-out Maven plugin out there in terms of usability
> wrt multi-module projects, and without being "hackish"; without that,
> people keep having to install all their snapshots into their local repo and
> rebuilding them over and over again, if only to make sure they're the ones
> for the correct commit / code state)
>
>
> > Le sam. 13 janv. 2018 03:33, Sigmond Hola <[hidden email]> a
> > écrit :
> >
> >> I have a multi-module project like this:
> >>
> >> ROOT:pom
> >>     --- web:war
> >>     --- domain:jar
> >>     --- service:jar
> >>     --- dao:jar
> >>
> >> And i configure tomcat7-maven-plugin in pom.xml of module *web *so that
> I
> >> can using tomcat:run to run this web application.
> >>
> >> But if I change something in other module, for example, add a new entity
> >> class in module domain, I have to install the ROOT to local repo first
> >> before I run tomcat:run within module web, otherwise a error: cannot
> find
> >> symbol will be reported if I run tomcat:run directly.
> >>
> >> So how can I install other modules first before I run tomcat:run within
> >> module web if I change something in other modules?
> >>
> >> Thanks in advance.
> >>
> >> Best regards.
> >>
> >
>



--
Olivier Lamy
http://twitter.com/olamy | http://linkedin.com/in/olamy
Reply | Threaded
Open this post in threaded view
|

Re: Running tomcat maven plugin in a multi modules project

Thomas Broyer-2
Oh great, thanks for the heads up! (I had asked for this years ago and then
they moved to Eclipse and I lost track)

Le sam. 13 janv. 2018 23:24, Olivier Lamy <[hidden email]> a écrit :

> Hi,
> Well to be fair Jetty Maven Plugin has now this feature as well...
>
> On 14 January 2018 at 03:25, Thomas Broyer <[hidden email]> wrote:
>
> > On Sat, Jan 13, 2018 at 3:20 PM Thomas Broyer <[hidden email]>
> wrote:
> >
> > > Tomcat Maven plugin has built-in support for reactors, so run it at
> root
> > > rather than within the web submodule (possibly with "-pl web -am"). It
> > will
> > > automatically compile all (needed) submodules and launch Tomcat, and
> with
> > > auto-deploy will automatically reload the webapp to pickup changes in
> any
> > > submodule.
> > >
> >
> > From https://tomcat.apache.org/maven-plugin-2.2/run-mojo-features.html
> > > NOTE If you have a multi module Maven project and use Maven3,
> > > you don't need to install all modules before using the run goal, just
> > > use tomcat6/7:run from the root module and the plugin will auto
> > > detect the build output directory from various modules and replace
> > > dependencies with those directories in the webapp classloader.
> >
> > (too bad there's been no new release for 4 years though, this is probably
> > one of the best thought-out Maven plugin out there in terms of usability
> > wrt multi-module projects, and without being "hackish"; without that,
> > people keep having to install all their snapshots into their local repo
> and
> > rebuilding them over and over again, if only to make sure they're the
> ones
> > for the correct commit / code state)
> >
> >
> > > Le sam. 13 janv. 2018 03:33, Sigmond Hola <[hidden email]> a
> > > écrit :
> > >
> > >> I have a multi-module project like this:
> > >>
> > >> ROOT:pom
> > >>     --- web:war
> > >>     --- domain:jar
> > >>     --- service:jar
> > >>     --- dao:jar
> > >>
> > >> And i configure tomcat7-maven-plugin in pom.xml of module *web *so
> that
> > I
> > >> can using tomcat:run to run this web application.
> > >>
> > >> But if I change something in other module, for example, add a new
> entity
> > >> class in module domain, I have to install the ROOT to local repo first
> > >> before I run tomcat:run within module web, otherwise a error: cannot
> > find
> > >> symbol will be reported if I run tomcat:run directly.
> > >>
> > >> So how can I install other modules first before I run tomcat:run
> within
> > >> module web if I change something in other modules?
> > >>
> > >> Thanks in advance.
> > >>
> > >> Best regards.
> > >>
> > >
> >
>
>
>
> --
> Olivier Lamy
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
Reply | Threaded
Open this post in threaded view
|

Re: Running tomcat maven plugin in a multi modules project

mgainty
FWIK of TC

anything you pack into war deployed to $TOMCAT_HOME will be unpacked when TC autodeploy feature is true

if you may have something like contents of webapp1:
webapp1/WEB-INF/classes/AllWebapp1*.class

              ./WEB-INF/lib/dependencyA.jar

              ./WEB-INF/lib/dependencyB.jar

              ./WEB-INF/web.xml

              ./WEB-INF/index.jsp

*when TC HTTPClient issues request to http://server:8080/reload?path=webapp1.war will reload (when autodeploy=true)*

$TOMCAT_HOME/webapps/webapp1/WEB-INF/classes/AllWebapp1*.class

                                                             ./WEB-INF/lib/dependencyA.jar

                                                             ./WEB-INF/lib/dependencyB.jar

                                                             ./WEB-INF/web.xml

                                                             ./WEB-INF/index.jsp

so the effort here is to fatpack your webapp war with all dependencies will need before issuing HTTPClient request to tc


does this conform to your understanding?

Martin
______________________________________________



________________________________
From: Thomas Broyer <[hidden email]>
Sent: Sunday, January 14, 2018 3:32 AM
To: Maven Users List
Subject: Re: Running tomcat maven plugin in a multi modules project

Oh great, thanks for the heads up! (I had asked for this years ago and then
they moved to Eclipse and I lost track)

Le sam. 13 janv. 2018 23:24, Olivier Lamy <[hidden email]> a écrit :

> Hi,
> Well to be fair Jetty Maven Plugin has now this feature as well...
>
> On 14 January 2018 at 03:25, Thomas Broyer <[hidden email]> wrote:
>
> > On Sat, Jan 13, 2018 at 3:20 PM Thomas Broyer <[hidden email]>
> wrote:
> >
> > > Tomcat Maven plugin has built-in support for reactors, so run it at
> root
> > > rather than within the web submodule (possibly with "-pl web -am"). It
> > will
> > > automatically compile all (needed) submodules and launch Tomcat, and
> with
> > > auto-deploy will automatically reload the webapp to pickup changes in
> any
> > > submodule.
> > >
> >
> > From https://tomcat.apache.org/maven-plugin-2.2/run-mojo-features.html
Apache Tomcat Maven Plugin - Run Mojo<https://tomcat.apache.org/maven-plugin-2.2/run-mojo-features.html>
tomcat.apache.org
Run Mojo: run your Maven war project quickly! When developing a war project, you usually build your war and deploy it to an installed Tomcat instance.



> > > NOTE If you have a multi module Maven project and use Maven3,
> > > you don't need to install all modules before using the run goal, just
> > > use tomcat6/7:run from the root module and the plugin will auto
> > > detect the build output directory from various modules and replace
> > > dependencies with those directories in the webapp classloader.
> >
> > (too bad there's been no new release for 4 years though, this is probably
> > one of the best thought-out Maven plugin out there in terms of usability
> > wrt multi-module projects, and without being "hackish"; without that,
> > people keep having to install all their snapshots into their local repo
> and
> > rebuilding them over and over again, if only to make sure they're the
> ones
> > for the correct commit / code state)
> >
> >
> > > Le sam. 13 janv. 2018 03:33, Sigmond Hola <[hidden email]> a
> > > écrit :
> > >
> > >> I have a multi-module project like this:
> > >>
> > >> ROOT:pom
> > >>     --- web:war
> > >>     --- domain:jar
> > >>     --- service:jar
> > >>     --- dao:jar
> > >>
> > >> And i configure tomcat7-maven-plugin in pom.xml of module *web *so
> that
> > I
> > >> can using tomcat:run to run this web application.
> > >>
> > >> But if I change something in other module, for example, add a new
> entity
> > >> class in module domain, I have to install the ROOT to local repo first
> > >> before I run tomcat:run within module web, otherwise a error: cannot
> > find
> > >> symbol will be reported if I run tomcat:run directly.
> > >>
> > >> So how can I install other modules first before I run tomcat:run
> within
> > >> module web if I change something in other modules?
> > >>
> > >> Thanks in advance.
> > >>
> > >> Best regards.
> > >>
> > >
> >
>
>
>
> --
> Olivier Lamy
> http://twitter.com/olamy | http://linkedin.com/in/olamy
[https://media-exp2.licdn.com/mpr/mpr/shrinknp_200_200/AAEAAQAAAAAAAAaBAAAAJDY5Y2Q3ZjA5LTAzMGItNGRlNC05MTdjLTM2ZDMzMjdkYzkwOQ.jpg]<http://linkedin.com/in/olamy>

Olivier Lamy | Professional Profile | LinkedIn<http://linkedin.com/in/olamy>
linkedin.com
View Olivier Lamy’s professional profile on LinkedIn. LinkedIn is the world's largest business network, helping professionals like Olivier Lamy discover inside connections to recommended job candidates, industry experts, and business partners.


[https://abs.twimg.com/a/1513823426/img/search/ic_places_foursquare_logo.png]<http://twitter.com/olamy>

Olivier Lamy (@olamy) | Twitter<http://twitter.com/olamy>
twitter.com
The latest Tweets from Olivier Lamy (@olamy). Speaking English with a strong French accent! #OpenSource #Apache #jetty #jenkins #ultrarunning. Living #downunder ...



>