You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matt Raible <ma...@raibledesigns.com> on 2003/10/29 23:53:12 UTC

Building a jar of a some of a webapp's classes

I am using Maven to build struts-menu 
(http://sf.net/projects/struts-menu).  Since this is a tag library - I 
want to build the struts-menu.jar from my target/struts-menu/classes 
directory, but I don't want to include net/sf/navigator/example/* 
classes.  I want the example classes to remain in WEB-INF/classes and 
move the rest to WEB-INF/lib/struts-menu.jar before deployment.  This 
will allow the struts-menu.war (example app) to use the same setup that 
users will use.  What is the best place to do this - in a <preGoal> of 
webapp:war?  Does anyone have any samples of this lying around?

Thanks,

Matt


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


Re: Building a jar of a some of a webapp's classes [solved]

Posted by Matt Raible <ma...@raibledesigns.com>.
I got what I wanted by doing the following:

1.  In project.properties, I have:
maven.war.classes.excludes=**/navigator/displayer/*
maven.war.classes.includes=**/navigator/example/*
maven.jar.excludes=**/example/*

2.  In maven.xml I added:

     <!-- create jar file for struts-menu and include it in WEB-INF/lib 
-->
     <postGoal name="war:webapp">
         <attainGoal name="jar"/>
         <copy file="${maven.build.dir}/${maven.final.name}.jar"
             todir="${maven.build.dir}/${pom.artifactId}/WEB-INF/lib"/>
     </postGoal>

This accomplished what I was looking for.

Thanks,

Matt

On Oct 30, 2003, at 11:24 AM, Matt Raible wrote:

> Doing two subprojects seems like a lot of work to me - if it's not, 
> please provide a link (or short howto) on how I can do this.  In the 
> meantime, here's what I've done:
>
> 1.  Include **/example from the war.src, excluded everything else
> 2.  Excluded **/example from the jar.src
>
> It seems like it should be pretty easy to just make the war goal 
> depend on jar and then have the jar included in WEB-INF/lib of the 
> war.  Is this not possible?  It seems like a quick and easy solution.
>
> Matt
>
> On Oct 29, 2003, at 7:45 PM, matt wrote:
>
>> Recommend two subprojects - one for the tag library and one for the 
>> example web application, with the web application having a dependency 
>> on the tag library.  This would make repository management easier, 
>> too.
>>
>> Matt Raible wrote:
>>
>>> I am using Maven to build struts-menu 
>>> (http://sf.net/projects/struts-menu).  Since this is a tag library - 
>>> I want to build the struts-menu.jar from my 
>>> target/struts-menu/classes directory, but I don't want to include 
>>> net/sf/navigator/example/* classes.  I want the example classes to 
>>> remain in WEB-INF/classes and move the rest to 
>>> WEB-INF/lib/struts-menu.jar before deployment.  This will allow the 
>>> struts-menu.war (example app) to use the same setup that users will 
>>> use.  What is the best place to do this - in a <preGoal> of 
>>> webapp:war?  Does anyone have any samples of this lying around?
>>>
>>> Thanks,
>>>
>>> Matt
>


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


Re: Building a jar of a some of a webapp's classes

Posted by Gilles Dodinet <rh...@wanadoo.fr>.
what about adding  a sourceModifications element in your pom ? I guess 
it can help you, tho ive never used it yet. Id also like to hear if this 
a use case where sourceModifications should be applied.

http://maven.apache.org/reference/project-descriptor.html#sourceModifications

-- gd

Matt Raible wrote:

> Doing two subprojects seems like a lot of work to me - if it's not, 
> please provide a link (or short howto) on how I can do this.  In the 
> meantime, here's what I've done:
>
> 1.  Include **/example from the war.src, excluded everything else
> 2.  Excluded **/example from the jar.src
>
> It seems like it should be pretty easy to just make the war goal 
> depend on jar and then have the jar included in WEB-INF/lib of the 
> war.  Is this not possible?  It seems like a quick and easy solution.
>
> Matt
>
> On Oct 29, 2003, at 7:45 PM, matt wrote:
>
>> Recommend two subprojects - one for the tag library and one for the 
>> example web application, with the web application having a dependency 
>> on the tag library.  This would make repository management easier, too.
>>
>> Matt Raible wrote:
>>
>>> I am using Maven to build struts-menu 
>>> (http://sf.net/projects/struts-menu).  Since this is a tag library - 
>>> I want to build the struts-menu.jar from my 
>>> target/struts-menu/classes directory, but I don't want to include 
>>> net/sf/navigator/example/* classes.  I want the example classes to 
>>> remain in WEB-INF/classes and move the rest to 
>>> WEB-INF/lib/struts-menu.jar before deployment.  This will allow the 
>>> struts-menu.war (example app) to use the same setup that users will 
>>> use.  What is the best place to do this - in a <preGoal> of 
>>> webapp:war?  Does anyone have any samples of this lying around?
>>>
>>> Thanks,
>>>
>>> Matt
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>
>
> ---------------------------------------------------------------------
> 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


Re: Building a jar of a some of a webapp's classes

Posted by Matt Raible <ma...@raibledesigns.com>.
Doing two subprojects seems like a lot of work to me - if it's not, 
please provide a link (or short howto) on how I can do this.  In the 
meantime, here's what I've done:

1.  Include **/example from the war.src, excluded everything else
2.  Excluded **/example from the jar.src

It seems like it should be pretty easy to just make the war goal depend 
on jar and then have the jar included in WEB-INF/lib of the war.  Is 
this not possible?  It seems like a quick and easy solution.

Matt

On Oct 29, 2003, at 7:45 PM, matt wrote:

> Recommend two subprojects - one for the tag library and one for the 
> example web application, with the web application having a dependency 
> on the tag library.  This would make repository management easier, 
> too.
>
> Matt Raible wrote:
>
>> I am using Maven to build struts-menu 
>> (http://sf.net/projects/struts-menu).  Since this is a tag library - 
>> I want to build the struts-menu.jar from my 
>> target/struts-menu/classes directory, but I don't want to include 
>> net/sf/navigator/example/* classes.  I want the example classes to 
>> remain in WEB-INF/classes and move the rest to 
>> WEB-INF/lib/struts-menu.jar before deployment.  This will allow the 
>> struts-menu.war (example app) to use the same setup that users will 
>> use.  What is the best place to do this - in a <preGoal> of 
>> webapp:war?  Does anyone have any samples of this lying around?
>>
>> Thanks,
>>
>> Matt
>>
>>
>> ---------------------------------------------------------------------
>> 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


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


Re: Building a jar of a some of a webapp's classes

Posted by matt <jo...@whitesmiths.com.au>.
Recommend two subprojects - one for the tag library and one for the 
example web application, with the web application having a dependency on 
the tag library.  This would make repository management easier, too.

Matt Raible wrote:

> I am using Maven to build struts-menu 
> (http://sf.net/projects/struts-menu).  Since this is a tag library - I 
> want to build the struts-menu.jar from my target/struts-menu/classes 
> directory, but I don't want to include net/sf/navigator/example/* 
> classes.  I want the example classes to remain in WEB-INF/classes and 
> move the rest to WEB-INF/lib/struts-menu.jar before deployment.  This 
> will allow the struts-menu.war (example app) to use the same setup 
> that users will use.  What is the best place to do this - in a 
> <preGoal> of webapp:war?  Does anyone have any samples of this lying 
> around?
>
> Thanks,
>
> Matt
>
>
> ---------------------------------------------------------------------
> 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