[jira] (JETTY-1517) Resolve submodule artifacts in reactor builds with Maven 3

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] (JETTY-1517) Resolve submodule artifacts in reactor builds with Maven 3

JIRA jira@codehaus.org
 
Thomas Broyer edited a comment on Improvement JETTY-1517

You're right, it comes for free with dependency resolution. It looks like the only issue is that jetty:run does not ignore non-war projects (see below). Note that it would then work but would include the dependent projects' build.outputDirectory to the setWebInfLib, which is weird (adding a directory to what is expected to be a list of JARs); but that's a detail.

As for mvn jetty:run -pl my-webapp -am it'll invoke jetty:run on each project, starting with the reactor. For example, in a project where basic-server depends on basic-shared:jar and basic-client:war, with basic being the parent/reactor module, mvn -pl basic-server -am jetty:run gives the following:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] basic
[INFO] basic-shared
[INFO] basic-client
[INFO] basic-server
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building basic 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> jetty-maven-plugin:8.1.3.v20120416:run (default-cli) @ basic >>>
[INFO] 
[INFO] <<< jetty-maven-plugin:8.1.3.v20120416:run (default-cli) @ basic <<<
[INFO] 
[INFO] --- jetty-maven-plugin:8.1.3.v20120416:run (default-cli) @ basic ---
[INFO] Configuring Jetty for project: basic
[INFO] webAppSourceDirectory /home/…/basic/src/main/webapp does not exist. Defaulting to /home/…/basic/src/main/webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes directory /home/…/basic/target/classes does not exist
[INFO] Context path = /
[INFO] Tmp directory = /home/…/basic/target/tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = null
[INFO] Webapp directory = /home/…/basic/src/main/webapp
2012-08-21 10:49:04.473:INFO:oejs.Server:jetty-8.1.3.v20120416
2012-08-21 10:49:04.617:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
2012-08-21 10:49:04.986:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/home/…/basic/src/main/webapp},file:/home/…/basic/src/main/webapp
2012-08-21 10:49:04.986:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/home/…/basic/src/main/webapp},file:/home/…/basic/src/main/webapp
2012-08-21 10:49:04.986:INFO:oejsh.ContextHandler:started o.m.j.p.JettyWebAppContext{/,file:/home/…/basic/src/main/webapp},file:/home/…/basic/src/main/webapp
2012-08-21 10:49:05.068:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server

With Tomcat, each project would be compiled (due to the @Execute( phase = LifecyclePhase.PROCESS_CLASSES ) annotation on the mojo) but then the mojo would skip the module unless it's of type war (in my case, I then simply configure the plugin to skip the basic-client module, as it's only ever used as an overlay in basic-server and cannot be run standalone, so that mvn tomcat7:run -pl basic-server -am compiles all the basic-server dependencies and ends up launching basic-server in Tomcat).

This lead me to find a workaround to make it work like Tomcat: declare in the parent module that the jetty-maven-plugin is skipped by default (set skip to true in build/pluginManagement) and then set skip back to false in basic-server.
I.e. in basic:

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>jetty-maven-plugin</artifactId>
          <version>${jetty-maven-plugin.version}</version>
          <configuration>
            <skip>true</skip>
          </configuration>
        </plugin>

and then in basic-server:

  <properties>
    <jetty.skip>false</jetty.skip>
  </properties>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.mortbay.jetty</groupId>
          <artifactId>jetty-maven-plugin</artifactId>
          <configuration>
            <skip>${jetty.skip}</skip>
          </configuration>
        </plugin>

(or some variant using e.g. the default-cli execution ID)

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email