You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Christopher Tiwald <ct...@salsalabs.com> on 2011/07/22 01:51:04 UTC

Dumb packaging question

This thing's driving me nuts, so I'm hoping for a little group wisdom. 
I'm trying to package a WAR with some run-time libraries (i.e. unused in 
compilation), but without other libraries (that throw tomcat errors 
because tomcat already has them).

i.e. I'm trying to do the following simultaneously:

package(:war).libs += (LIBRARY_A, LIBRARY_B)
package(:war).libs -= (LIBRARY_C)

The easiest way, of course, would be to just be write an array 
(PACKAGE_THESE_LIBRARIES) that comprises all the correct libraries, and 
then use the 'with' method. On the other hand I've got something like 
100 libraries and this doesn't strike me as terribly elegant. I'm trying 
to maximize understandability, readability, and repeatability, because 
our maven pom.xml's had none of those qualities.

Is there an obvious way to do this I'm missing here?

--
Christopher

Re: Dumb packaging question

Posted by Christopher Tiwald <ct...@salsalabs.com>.
Thanks much. Figured I was getting hung up on the syntax. This is very helpful.

--
Christopher

----- Original Message -----
From: "Antoine Toulme" <an...@lunar-ocean.com>
To: users@buildr.apache.org
Sent: Thursday, July 21, 2011 9:38:28 PM
Subject: Re: Dumb packaging question

There's a dozen ways to spread the butter on the bread here. Here is my
humble take:

You can use the union construct: |

package(:war).libs |= [LIB_A, LIB_B]

If you have arrays of arrays, you can flatten:

package(:war).libs |= [LIB_A, LIB_B, [LIB_C, LIB_D]].flatten

To remove stuff selectively, use the delete method ?

package(:war).libs.delete(LIB_C)

The array class in Ruby is very interesting. I recommend keeping this
page
around:
http://www.ruby-doc.org/core/classes/Array.html

Arrays are Enumerable (think java.util.Collection) so this is a good
read
too:
http://www.ruby-doc.org/core/classes/Enumerable.html

On Thu, Jul 21, 2011 at 23:51, Christopher Tiwald
<ct...@salsalabs.com>wrote:

> This thing's driving me nuts, so I'm hoping for a little group wisdom.
> I'm trying to package a WAR with some run-time libraries (i.e. unused
> in compilation), but without other libraries (that throw tomcat errors
> because tomcat already has them).
>
> i.e. I'm trying to do the following simultaneously:
>
> package(:war).libs += (LIBRARY_A, LIBRARY_B)
> package(:war).libs -= (LIBRARY_C)
>
> The easiest way, of course, would be to just be write an array
> (PACKAGE_THESE_LIBRARIES) that comprises all the correct libraries,
> and then
> use the 'with' method. On the other hand I've got something like 100
> libraries and this doesn't strike me as terribly elegant. I'm trying
> to maximize understandability, readability, and repeatability, because
> our maven pom.xml's had none of those qualities.
>
> Is there an obvious way to do this I'm missing here?
>
> -- Christopher
>

Re: Dumb packaging question

Posted by Antoine Toulme <an...@lunar-ocean.com>.
There's a dozen ways to spread the butter on the bread here. Here is my
humble take:

You can use the union construct: |

package(:war).libs |= [LIB_A, LIB_B]

If you have arrays of arrays, you can flatten:

package(:war).libs |= [LIB_A, LIB_B, [LIB_C, LIB_D]].flatten

To remove stuff selectively, use the delete method ?

package(:war).libs.delete(LIB_C)

The array class in Ruby is very interesting. I recommend keeping this page
around:
http://www.ruby-doc.org/core/classes/Array.html

Arrays are Enumerable (think java.util.Collection) so this is a good read
too:
http://www.ruby-doc.org/core/classes/Enumerable.html

On Thu, Jul 21, 2011 at 23:51, Christopher Tiwald <ct...@salsalabs.com>wrote:

> This thing's driving me nuts, so I'm hoping for a little group wisdom. I'm
> trying to package a WAR with some run-time libraries (i.e. unused in
> compilation), but without other libraries (that throw tomcat errors because
> tomcat already has them).
>
> i.e. I'm trying to do the following simultaneously:
>
> package(:war).libs += (LIBRARY_A, LIBRARY_B)
> package(:war).libs -= (LIBRARY_C)
>
> The easiest way, of course, would be to just be write an array
> (PACKAGE_THESE_LIBRARIES) that comprises all the correct libraries, and then
> use the 'with' method. On the other hand I've got something like 100
> libraries and this doesn't strike me as terribly elegant. I'm trying to
> maximize understandability, readability, and repeatability, because our
> maven pom.xml's had none of those qualities.
>
> Is there an obvious way to do this I'm missing here?
>
> --
> Christopher
>