You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Frank Silbermann <fr...@fedex.com> on 2008/06/19 16:59:38 UTC

How to indicate dependency on a .war file?

I have a question about packaging.  I have two Wicket web  applications
that display data for two different corporate areas, but the
look-and-feel are similar.  Therefore, I coded in Wicket a tool project
consisting of a bunch of higher-level problem-specific components that
my two projects should depend upon.
 
In my tool project I built a web page that I use to test (display and
play with) these components.  Therefore, the output of my tool project
is also .war.  How do I tell Maven that my two business applications
depend upon a .war and not a .jar?  I'd rather not have to partition my
tool project into separate .war and .jar projects.
 
 

Re: How to indicate dependency on a .war file?

Posted by John Krasnay <jo...@krasnay.ca>.
You can't AFAIK. A WAR file is not a JAR file, e.g. the contained
classfiles are under WEB-INF/classes, not the root.

You're shared component should be a JAR project instead of a WAR
project. Just remember to mount your test page in each app in which you
use it.

jk

On Thu, Jun 19, 2008 at 09:59:38AM -0500, Frank Silbermann wrote:
> I have a question about packaging.  I have two Wicket web  applications
> that display data for two different corporate areas, but the
> look-and-feel are similar.  Therefore, I coded in Wicket a tool project
> consisting of a bunch of higher-level problem-specific components that
> my two projects should depend upon.
>  
> In my tool project I built a web page that I use to test (display and
> play with) these components.  Therefore, the output of my tool project
> is also .war.  How do I tell Maven that my two business applications
> depend upon a .war and not a .jar?  I'd rather not have to partition my
> tool project into separate .war and .jar projects.
>  
>  

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


Re: How to indicate dependency on a .war file?

Posted by Brill Pappin <br...@pappin.ca>.
<chuckle>

I've used a few convoluted ways of doing it including a combination of  
the dependency plugin to get the war dep and the antrun plugin to  
extract it, but the war overlay (which I only discovered a few months  
ago) is a much nicer way of doing it :)


- Brill Pappin


On 19-Jun-08, at 11:26 AM, John Krasnay wrote:

> On Thu, Jun 19, 2008 at 11:09:57AM -0400, Brill Pappin wrote:
>> Look up "war overlay" in the maven-war-plugin that will give you some
>> useful information on what you want to do beyond your original
>> questions.
>>
>> as for dep types.
>> A war can be depended upon just like a jar (or anything else for that
>> matter) you simply specify the type:
>> <dependency>
>> 	<groupId>com.mypackage</groupId>
>> 	<artifactId>mywebapp</artifactId>
>> 	<version>1.0.0XXX</version>
>> 	<type>war</type>
>> </dependency>
>>
>> - Brill Pappin
>
> Doh, I knew as soon as I sent my response that someone would pipe up
> with a slick way of doing it in Maven!
>
> jk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: How to indicate dependency on a .war file?

Posted by John Krasnay <jo...@krasnay.ca>.
On Thu, Jun 19, 2008 at 11:09:57AM -0400, Brill Pappin wrote:
> Look up "war overlay" in the maven-war-plugin that will give you some  
> useful information on what you want to do beyond your original  
> questions.
> 
> as for dep types.
> A war can be depended upon just like a jar (or anything else for that  
> matter) you simply specify the type:
> <dependency>
> 	<groupId>com.mypackage</groupId>
> 	<artifactId>mywebapp</artifactId>
> 	<version>1.0.0XXX</version>
> 	<type>war</type>
> </dependency>
> 
> - Brill Pappin

Doh, I knew as soon as I sent my response that someone would pipe up
with a slick way of doing it in Maven!

jk

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


Re: How to indicate dependency on a .war file?

Posted by John Krasnay <jo...@krasnay.ca>.
On Thu, Jun 19, 2008 at 11:22:03AM -0500, Frank Silbermann wrote:
> OK, so I need to package my dependency as a JAR file because I need to
> add it to my classpath in Eclipse.
> 
> I am not sure how the war overlay tool will help me; it seems to be used
> for getting resources out of a .war file, and we've concluded that I
> need a JAR file, right?  Is there an easy way to tell Maven to create
> both a JAR and a WAR file from the same codebase?
> 

Maven tends towards one artifact per project, and I've come to let Maven
have it's way. One solution is to have a small test WAR project that
depends on your JAR project. It's slightly cleaner too, since (if you
like) you can keep your test code out of the JAR, and therefore out of
your production code.

jk

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


Re: How to indicate dependency on a .war file?

Posted by Brill Pappin <br...@pappin.ca>.
overlay takes two war files and merges them.

so whatever classes and resources you have in one will be included in  
the other.

The reason to use a war instead of a jar is if you want to be able to  
run that common war in its own (for dev and debug)


- Brill Pappin

On 19-Jun-08, at 12:22 PM, Frank Silbermann wrote:

> OK, so I need to package my dependency as a JAR file because I need to
> add it to my classpath in Eclipse.
>
> I am not sure how the war overlay tool will help me; it seems to be  
> used
> for getting resources out of a .war file, and we've concluded that I
> need a JAR file, right?  Is there an easy way to tell Maven to create
> both a JAR and a WAR file from the same codebase?
>
> Or, perhaps if I am satisfied to test the common code in Eclipse via
> Jetty I don't need to create a WAR file at all?
>
> -----Original Message-----
> From: Brill Pappin [mailto:brill@pappin.ca]
> Sent: Thursday, June 19, 2008 11:06 AM
> To: users@wicket.apache.org
> Subject: Re: How to indicate dependency on a .war file?
>
> if you need to do that, then John was right, package it as a JAR file.
> In your case you presumably don't need all the webapp metadata that
> usually goes along with a war.
>
>
> However, it still might be worth using the overlay feature because it
> means you can easily run the separate wars for debugging and  
> development
> (which it sounds like you are doing). The result however will pretty
> much be the same.
>
> 1) if you *are not* "running" the common war code for independent
> debugging, package it as a jar.
> 2) if you *are* independently running the common code, then use the  
> war
> overlay.
>
> there is *no* way to get eclipse to see your war as a dependency in  
> the
> eclipse classpath (as John pointed out) because a war is a packaged
> application, not a library.
>
> - Brill Pappin
>
>
> On 19-Jun-08, at 11:55 AM, Frank Silbermann wrote:
>
>> That satisfies Maven, thanks!  I'm not looking to add any resources  
>> or
>
>> pages from the dependency, just the java classes and HTML files, so I
>> don't think I need the "war overlay" feature.  But now I have another
>> problem.
>>
>> For debugging in eclipse, how do I tell Eclipse about this  
>> dependency?
>> When I ran "mvn eclipse:eclipse" it did not produce a classpath
>> reference for the .war file.  When I hand coded the path to the .war
>> file in my local Maven repository, Eclipse couldn't use it -- perhaps
>> because the .war file places the .class and .html files inside the
>> WEB-INF/classes folder.
>>
>> Is there a way I can expose the classes in the .war file to Eclipse?
>>
>> -----Original Message-----
>> From: Brill Pappin [mailto:brill@pappin.ca]
>> Sent: Thursday, June 19, 2008 10:10 AM
>> To: users@wicket.apache.org
>> Subject: Re: How to indicate dependency on a .war file?
>>
>> Look up "war overlay" in the maven-war-plugin that will give you some
>> useful information on what you want to do beyond your original
>> questions.
>>
>> as for dep types.
>> A war can be depended upon just like a jar (or anything else for that
>> matter) you simply specify the type:
>> <dependency>
>> 	<groupId>com.mypackage</groupId>
>> 	<artifactId>mywebapp</artifactId>
>> 	<version>1.0.0XXX</version>
>> 	<type>war</type>
>> </dependency>
>>
>> - Brill Pappin
>>
>>
>> On 19-Jun-08, at 10:59 AM, Frank Silbermann wrote:
>>
>>> I have a question about packaging.  I have two Wicket web
>>> applications that display data for two different corporate areas,  
>>> but
>
>>> the look-and-feel are similar.  Therefore, I coded in Wicket a tool
>>> project consisting of a bunch of higher-level problem-specific
>>> components that my two projects should depend upon.
>>>
>>> In my tool project I built a web page that I use to test (display  
>>> and
>
>>> play with) these components.  Therefore, the output of my tool
>>> project
>>
>>> is also .war.  How do I tell Maven that my two business applications
>>> depend upon a .war and not a .jar?  I'd rather not have to partition
>>> my tool project into separate .war and .jar projects.
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


RE: How to indicate dependency on a .war file?

Posted by Frank Silbermann <fr...@fedex.com>.
OK, so I need to package my dependency as a JAR file because I need to
add it to my classpath in Eclipse.

I am not sure how the war overlay tool will help me; it seems to be used
for getting resources out of a .war file, and we've concluded that I
need a JAR file, right?  Is there an easy way to tell Maven to create
both a JAR and a WAR file from the same codebase?

Or, perhaps if I am satisfied to test the common code in Eclipse via
Jetty I don't need to create a WAR file at all? 

-----Original Message-----
From: Brill Pappin [mailto:brill@pappin.ca] 
Sent: Thursday, June 19, 2008 11:06 AM
To: users@wicket.apache.org
Subject: Re: How to indicate dependency on a .war file?

if you need to do that, then John was right, package it as a JAR file.  
In your case you presumably don't need all the webapp metadata that
usually goes along with a war.


However, it still might be worth using the overlay feature because it
means you can easily run the separate wars for debugging and development
(which it sounds like you are doing). The result however will pretty
much be the same.

1) if you *are not* "running" the common war code for independent
debugging, package it as a jar.
2) if you *are* independently running the common code, then use the war
overlay.

there is *no* way to get eclipse to see your war as a dependency in the
eclipse classpath (as John pointed out) because a war is a packaged
application, not a library.

- Brill Pappin


On 19-Jun-08, at 11:55 AM, Frank Silbermann wrote:

> That satisfies Maven, thanks!  I'm not looking to add any resources or

> pages from the dependency, just the java classes and HTML files, so I 
> don't think I need the "war overlay" feature.  But now I have another 
> problem.
>
> For debugging in eclipse, how do I tell Eclipse about this dependency?
> When I ran "mvn eclipse:eclipse" it did not produce a classpath 
> reference for the .war file.  When I hand coded the path to the .war 
> file in my local Maven repository, Eclipse couldn't use it -- perhaps 
> because the .war file places the .class and .html files inside the 
> WEB-INF/classes folder.
>
> Is there a way I can expose the classes in the .war file to Eclipse?
>
> -----Original Message-----
> From: Brill Pappin [mailto:brill@pappin.ca]
> Sent: Thursday, June 19, 2008 10:10 AM
> To: users@wicket.apache.org
> Subject: Re: How to indicate dependency on a .war file?
>
> Look up "war overlay" in the maven-war-plugin that will give you some 
> useful information on what you want to do beyond your original 
> questions.
>
> as for dep types.
> A war can be depended upon just like a jar (or anything else for that
> matter) you simply specify the type:
> <dependency>
> 	<groupId>com.mypackage</groupId>
> 	<artifactId>mywebapp</artifactId>
> 	<version>1.0.0XXX</version>
> 	<type>war</type>
> </dependency>
>
> - Brill Pappin
>
>
> On 19-Jun-08, at 10:59 AM, Frank Silbermann wrote:
>
>> I have a question about packaging.  I have two Wicket web 
>> applications that display data for two different corporate areas, but

>> the look-and-feel are similar.  Therefore, I coded in Wicket a tool 
>> project consisting of a bunch of higher-level problem-specific 
>> components that my two projects should depend upon.
>>
>> In my tool project I built a web page that I use to test (display and

>> play with) these components.  Therefore, the output of my tool 
>> project
>
>> is also .war.  How do I tell Maven that my two business applications 
>> depend upon a .war and not a .jar?  I'd rather not have to partition 
>> my tool project into separate .war and .jar projects.
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


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


Re: How to indicate dependency on a .war file?

Posted by Brill Pappin <br...@pappin.ca>.
if you need to do that, then John was right, package it as a JAR file.  
In your case you presumably don't need all the webapp metadata that  
usually goes along with a war.


However, it still might be worth using the overlay feature because it  
means you can easily run the separate wars for debugging and  
development (which it sounds like you are doing). The result however  
will pretty much be the same.

1) if you *are not* "running" the common war code for independent  
debugging, package it as a jar.
2) if you *are* independently running the common code, then use the  
war overlay.

there is *no* way to get eclipse to see your war as a dependency in  
the eclipse classpath (as John pointed out) because a war is a  
packaged application, not a library.

- Brill Pappin


On 19-Jun-08, at 11:55 AM, Frank Silbermann wrote:

> That satisfies Maven, thanks!  I'm not looking to add any resources or
> pages from the dependency, just the java classes and HTML files, so I
> don't think I need the "war overlay" feature.  But now I have another
> problem.
>
> For debugging in eclipse, how do I tell Eclipse about this dependency?
> When I ran "mvn eclipse:eclipse" it did not produce a classpath
> reference for the .war file.  When I hand coded the path to the .war
> file in my local Maven repository, Eclipse couldn't use it -- perhaps
> because the .war file places the .class and .html files inside the
> WEB-INF/classes folder.
>
> Is there a way I can expose the classes in the .war file to Eclipse?
>
> -----Original Message-----
> From: Brill Pappin [mailto:brill@pappin.ca]
> Sent: Thursday, June 19, 2008 10:10 AM
> To: users@wicket.apache.org
> Subject: Re: How to indicate dependency on a .war file?
>
> Look up "war overlay" in the maven-war-plugin that will give you some
> useful information on what you want to do beyond your original
> questions.
>
> as for dep types.
> A war can be depended upon just like a jar (or anything else for that
> matter) you simply specify the type:
> <dependency>
> 	<groupId>com.mypackage</groupId>
> 	<artifactId>mywebapp</artifactId>
> 	<version>1.0.0XXX</version>
> 	<type>war</type>
> </dependency>
>
> - Brill Pappin
>
>
> On 19-Jun-08, at 10:59 AM, Frank Silbermann wrote:
>
>> I have a question about packaging.  I have two Wicket web
>> applications
>> that display data for two different corporate areas, but the
>> look-and-feel are similar.  Therefore, I coded in Wicket a tool
>> project consisting of a bunch of higher-level problem-specific
>> components that my two projects should depend upon.
>>
>> In my tool project I built a web page that I use to test (display and
>> play with) these components.  Therefore, the output of my tool  
>> project
>
>> is also .war.  How do I tell Maven that my two business applications
>> depend upon a .war and not a .jar?  I'd rather not have to partition
>> my tool project into separate .war and .jar projects.
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


RE: How to indicate dependency on a .war file?

Posted by Frank Silbermann <fr...@fedex.com>.
That satisfies Maven, thanks!  I'm not looking to add any resources or
pages from the dependency, just the java classes and HTML files, so I
don't think I need the "war overlay" feature.  But now I have another
problem.

For debugging in eclipse, how do I tell Eclipse about this dependency?
When I ran "mvn eclipse:eclipse" it did not produce a classpath
reference for the .war file.  When I hand coded the path to the .war
file in my local Maven repository, Eclipse couldn't use it -- perhaps
because the .war file places the .class and .html files inside the
WEB-INF/classes folder.

Is there a way I can expose the classes in the .war file to Eclipse?

-----Original Message-----
From: Brill Pappin [mailto:brill@pappin.ca] 
Sent: Thursday, June 19, 2008 10:10 AM
To: users@wicket.apache.org
Subject: Re: How to indicate dependency on a .war file?

Look up "war overlay" in the maven-war-plugin that will give you some
useful information on what you want to do beyond your original
questions.

as for dep types.
A war can be depended upon just like a jar (or anything else for that
matter) you simply specify the type:
<dependency>
	<groupId>com.mypackage</groupId>
	<artifactId>mywebapp</artifactId>
	<version>1.0.0XXX</version>
	<type>war</type>
</dependency>

- Brill Pappin


On 19-Jun-08, at 10:59 AM, Frank Silbermann wrote:

> I have a question about packaging.  I have two Wicket web   
> applications
> that display data for two different corporate areas, but the 
> look-and-feel are similar.  Therefore, I coded in Wicket a tool 
> project consisting of a bunch of higher-level problem-specific 
> components that my two projects should depend upon.
>
> In my tool project I built a web page that I use to test (display and 
> play with) these components.  Therefore, the output of my tool project

> is also .war.  How do I tell Maven that my two business applications 
> depend upon a .war and not a .jar?  I'd rather not have to partition 
> my tool project into separate .war and .jar projects.
>
>


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


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


Re: How to indicate dependency on a .war file?

Posted by Brill Pappin <br...@pappin.ca>.
Look up "war overlay" in the maven-war-plugin that will give you some  
useful information on what you want to do beyond your original  
questions.

as for dep types.
A war can be depended upon just like a jar (or anything else for that  
matter) you simply specify the type:
<dependency>
	<groupId>com.mypackage</groupId>
	<artifactId>mywebapp</artifactId>
	<version>1.0.0XXX</version>
	<type>war</type>
</dependency>

- Brill Pappin


On 19-Jun-08, at 10:59 AM, Frank Silbermann wrote:

> I have a question about packaging.  I have two Wicket web   
> applications
> that display data for two different corporate areas, but the
> look-and-feel are similar.  Therefore, I coded in Wicket a tool  
> project
> consisting of a bunch of higher-level problem-specific components that
> my two projects should depend upon.
>
> In my tool project I built a web page that I use to test (display and
> play with) these components.  Therefore, the output of my tool project
> is also .war.  How do I tell Maven that my two business applications
> depend upon a .war and not a .jar?  I'd rather not have to partition  
> my
> tool project into separate .war and .jar projects.
>
>


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