You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mike Leonardo <mi...@ifactory.com> on 2008/11/12 20:28:49 UTC

Using a WAR as a dependency

Hello,

I'm working on a multi-module web project and I find myself in a situation where I need the web-app packaged as both a jar and a war.

My project consists of:
 * parent module
 * integration-tests module
 * web-app module

I'm trying to set it up so that when I run "mvn:install" (from the root pom) it will install the webapp into the local repo as a war, and then the integration test module can both use classes from the webapp for tests, and also use the war to actually start up a jetty (using cargo) for testing.

My problem is that I have the webapp packaged as a war but when I try to run any test the testing module it can't find definitions for any of the classes in the webapp. In my testing pom.xml I have:

		<dependency>
		  <groupId>com.mycompany.app</groupId>
		  <artifactId>web-app</artifactId>
		  <version>1.0-SNAPSHOT</version>
	    	  <type>war</type>
	          <scope>runtime</scope>
		</dependency>

Am I setting this up correctly?

- Mike 

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


Re: Using a WAR as a dependency

Posted by Dan Tran <da...@gmail.com>.
You can configure the plugin to build and deploy your war's jar file
as a classifier

http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html

pay attention to "attachClasses" param

http://maven.apache.org/plugins/maven-war-plugin/war-mojo.html#attachClasses

-D

On Wed, Nov 12, 2008 at 11:28 AM, Mike Leonardo <mi...@ifactory.com> wrote:
> Hello,
>
> I'm working on a multi-module web project and I find myself in a situation where I need the web-app packaged as both a jar and a war.
>
> My project consists of:
>  * parent module
>  * integration-tests module
>  * web-app module
>
> I'm trying to set it up so that when I run "mvn:install" (from the root pom) it will install the webapp into the local repo as a war, and then the integration test module can both use classes from the webapp for tests, and also use the war to actually start up a jetty (using cargo) for testing.
>
> My problem is that I have the webapp packaged as a war but when I try to run any test the testing module it can't find definitions for any of the classes in the webapp. In my testing pom.xml I have:
>
>                <dependency>
>                  <groupId>com.mycompany.app</groupId>
>                  <artifactId>web-app</artifactId>
>                  <version>1.0-SNAPSHOT</version>
>                  <type>war</type>
>                  <scope>runtime</scope>
>                </dependency>
>
> Am I setting this up correctly?
>
> - Mike
>
> ---------------------------------------------------------------------
> 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