maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Connolly <stephen.alan.conno...@gmail.com>
Subject Re: effective practice for web application development using maven
Date Tue, 12 Mar 2013 09:11:40 GMT
It's rough and a little bit alpha still. Please take a look at
jszip.orgwhere I have the jszip-maven-plugin which will use it's
reactor spider
senses to build the classpath from the reactor, so e.g.

# from the root of the reactor
$ mvn compile org.jszip.maven:jszip-maven-plugin:run

will compile all your source code and start the first web application in
the reactor (there are cli options to help pick the web application to
serve) with dynamic reloading of the classpath... IOW when you recompile a
class in your IDE... webapp restarts to pick up the change... this is
because as long as you don't go past the "prepare-package" phase of the
lifecycle, the reactor points to ${project.build.outputDirectory} for the
primary artifact

OTOH, if you do

#from the root of the reactor
$ mvn package org.jszip.maven:jszip-maven-plugin:run

then only when you refresh the .jar file will the classpath be detected as
modified and the webapp restarted because on or after the "package" phase
in the lifecycle, the primary artifact is the .jar/.war/.ear/etc so
jszip-maven-plugin is watching for changes in that.

The jetty plugin is not fully reactor aware... in fact to my knowledge my
jszip-maven-plugin experiments are currently the only fully reactor and pom
change aware plugins... once I figure out a good API for handling this type
of stuff (the jszip-maven-plugin is currently full of hacks to make it do
the magic it does) I fully intend bringing the API to the ASF (hence why
all contributors to the jszip.org maven plugin must license under ASLv2.

If you don't like that my plugin is in alpha, I have heard that the webby
eclipse plugin offers a subset of the jszip-maven-plugin functionality for
people using Eclipse+M2E as their IDE.

Alternatively you can look into tools such as JRebel which support less
hard webapp reloading (where they dynamically replace the classes without
stop-starting the entire webapp) but AFAIR those options require paying
mony to use them after their evaluation period expires (unless you can get
a FOSS license for using them)

-Stephen


On 12 March 2013 07:24, maven apache <apachemaven0@gmail.com> wrote:

> Hi everyone:
>
> I am using maven3 as my J2EE application build tool.
>
> Now I meet some problem during my development --- I found it is so
> inflexible to do the test or debug in the multiple modules.
>
> For example, I have a parent maven project whose pom.xml is like this:
>
>     <modules>
>         <module>app-common</module>
>         <module>app-webapp</module>
>     </modules>
>
> And the app-common/pom.xml:
>
> <package>jar</package>
>
>
> the app-webapp/pom.xml:
>
>             <package>war</package>
>             <dependency>
>                 <groupId>${project.groupId}</groupId>
>                 <artifactId>app-common</artifactId>
>                 <version>${project.version}</version>
>             </dependency>
>     <build>
>         <finalName>app</finalName>
>         <plugins>
>             <plugin>
>                 <groupId>org.mortbay.jetty</groupId>
>                 <artifactId>maven-jetty-plugin</artifactId>
>                 <configuration>
>                     <scanIntervalSeconds>10</scanIntervalSeconds>
>                     <stopKey>foo</stopKey>
>                     <stopPort>9999</stopPort>
>                 </configuration>
>             </plugin>
>         </plugins>
>     </build>
>
> Now,the app-common project hold all the classed for the whole
> application,and the app-webapp is responsible for the presentation.
>
> As you can see I use the jetty to set up the web application.
>
> However, each time I make some change inside the project app-common, the
> jetty can not detect it which means that I have to run the "mvn install"
> under the parent project,and restart the jetty to see the update. This is
> too inflexible.
>
> So I wonder how do you guys do this kind of development?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message