You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by "Jesus M. Rodriguez" <jm...@gmail.com> on 2010/03/08 23:04:41 UTC

packaging jar file

I'm trying to package up our model classes in their own jar file with
the name of model.jar.

I got it to generate the jar file with just my model classes but can't
figure out how to give it a different name.

  package(:jar).clean.include
'target/classes/org/fedoraproject/candlepin/model',
:path=>"org/fedoraproject/candlepin/"

The next part is excluding those classes from the war file, any tips
on this would also be helpful.

Thanks in advance,

jesus rodriguez

Re: packaging jar file

Posted by "Jesus M. Rodriguez" <jm...@gmail.com>.
On Tue, Mar 9, 2010 at 1:12 PM, Alex Boisvert <al...@gmail.com> wrote:
> This should work,
>
> package(:war).path('WEB-INF/classes').exclude(_(:target, :classes,
> "org/fedoraproject/candlepin/model/**.class"))
>
> This exclude business is haphazard at best.  I had to try different
> combinations until I got to the working one.

Thanks Alex, that was much closer to what I wanted, but it left the
model directory.
So I removed **.class, and it left out /model/ altogether which is
what I wanted.

Thanks again.

> We're tracking this issue with
> http://issues.apache.org/jira/browse/BUILDR-335 and I'll hope to give it a
> good kick in the schnaz when I get time.

HAHA nice.

jesus

Re: packaging jar file

Posted by Alex Boisvert <al...@gmail.com>.
This should work,

package(:war).path('WEB-INF/classes').exclude(_(:target, :classes,
"org/fedoraproject/candlepin/model/**.class"))

This exclude business is haphazard at best.  I had to try different
combinations until I got to the working one.

We're tracking this issue with
http://issues.apache.org/jira/browse/BUILDR-335 and I'll hope to give it a
good kick in the schnaz when I get time.

alex


On Tue, Mar 9, 2010 at 8:41 AM, Jesus M. Rodriguez <jm...@gmail.com>wrote:

> On Mon, Mar 8, 2010 at 6:28 PM, Alex Boisvert <al...@gmail.com>
> wrote:
> > On Mon, Mar 8, 2010 at 2:04 PM, Jesus M. Rodriguez <jmrodri@gmail.com
> >wrote:
> >
> >> I'm trying to package up our model classes in their own jar file with
> >> the name of model.jar.
> >>
> >> I got it to generate the jar file with just my model classes but can't
> >> figure out how to give it a different name.
> >>
> >>  package(:jar).clean.include
> >> 'target/classes/org/fedoraproject/candlepin/model',
> >> :path=>"org/fedoraproject/candlepin/"
> >>
> >> The next part is excluding those classes from the war file, any tips
> >> on this would also be helpful.
> >>
> >> Thanks in advance,
> >>
> >>
> > Hi Jesus,
> >
> > To change the name you use the :id parameter,
> >
> > package :jar, :id=>'candlepin'
> >
> > To exclude classes from the .war, you have to use the (unintuitive) path
> +
> > exclude combination,
> >
> >
> package(:war).path('WEB-INF/classes').exclude('org/fedoraproject/candlepin/model/**/*')
>
> That doesn't seem to work. The war file still has all of the model
> classes in it.
> I tried a few things:
>
> package(:war).path('WEB-INF/classes').exclude('**/model/**/*')
> ...('WEB-INF/classes/**/model/**')
> ...('WEB-INF/classes/org/fedoraproject/candlepin/model/**')
> ...('org/fedoraproject/candlepin/model')
>
> and quite a few others :)
>
> jesus
>

Re: packaging jar file

Posted by "Jesus M. Rodriguez" <jm...@gmail.com>.
On Mon, Mar 8, 2010 at 6:28 PM, Alex Boisvert <al...@gmail.com> wrote:
> On Mon, Mar 8, 2010 at 2:04 PM, Jesus M. Rodriguez <jm...@gmail.com>wrote:
>
>> I'm trying to package up our model classes in their own jar file with
>> the name of model.jar.
>>
>> I got it to generate the jar file with just my model classes but can't
>> figure out how to give it a different name.
>>
>>  package(:jar).clean.include
>> 'target/classes/org/fedoraproject/candlepin/model',
>> :path=>"org/fedoraproject/candlepin/"
>>
>> The next part is excluding those classes from the war file, any tips
>> on this would also be helpful.
>>
>> Thanks in advance,
>>
>>
> Hi Jesus,
>
> To change the name you use the :id parameter,
>
> package :jar, :id=>'candlepin'
>
> To exclude classes from the .war, you have to use the (unintuitive) path +
> exclude combination,
>
> package(:war).path('WEB-INF/classes').exclude('org/fedoraproject/candlepin/model/**/*')

That doesn't seem to work. The war file still has all of the model
classes in it.
I tried a few things:

package(:war).path('WEB-INF/classes').exclude('**/model/**/*')
...('WEB-INF/classes/**/model/**')
...('WEB-INF/classes/org/fedoraproject/candlepin/model/**')
...('org/fedoraproject/candlepin/model')

and quite a few others :)

jesus

Re: packaging jar file

Posted by Alex Boisvert <al...@gmail.com>.
On Mon, Mar 8, 2010 at 2:04 PM, Jesus M. Rodriguez <jm...@gmail.com>wrote:

> I'm trying to package up our model classes in their own jar file with
> the name of model.jar.
>
> I got it to generate the jar file with just my model classes but can't
> figure out how to give it a different name.
>
>  package(:jar).clean.include
> 'target/classes/org/fedoraproject/candlepin/model',
> :path=>"org/fedoraproject/candlepin/"
>
> The next part is excluding those classes from the war file, any tips
> on this would also be helpful.
>
> Thanks in advance,
>
>
Hi Jesus,

To change the name you use the :id parameter,

package :jar, :id=>'candlepin'

To exclude classes from the .war, you have to use the (unintuitive) path +
exclude combination,

package(:war).path('WEB-INF/classes').exclude('org/fedoraproject/candlepin/model/**/*')

(I'm hoping to simplify the latter one day)

alex