Re: Including an assembly as part of another assembly

2006-12-04 Thread Eric Wang

Our projects are indeed pretty much the same. You just chose to
package it differently than I did (or am trying to).

In your case, you have your dependencies as separate jars. I used the
the jar-with-dependencies descriptor to pack everything into a single
jar.

Unfortunately, I can't seem to get Maven to package up my application
along with it's supporting files the way I want to, so I may just
change my application to use multiple jar files as well.

I appreciate your help with this problem Alexander.


On 12/4/06, Alexander Sack <[EMAIL PROTECTED]> wrote:

Eric, I have the eXACT same project.  My command line tool needs a couple of
runtime dependencies.

Let me show how I organize a project which works for me beautifully (maybe
this will help):

 

  acme-depedency-1
  acme-dpendency-1
  acme-dependency-1

..
..
..
  
  


  maven-compiler-plugin
  org.apache.maven.plugins
  
1.5
1.5
  

 
maven-assembly-plugin
2.0-beta-1

  src/main/assembly/acme-assembly.xml
  target
  target/assembly/work
  Acme

  
  
  org.apache.maven.plugins
  maven-jar-plugin
  

  
true
  com.acme.main.class
  

acme.jar
  
  

  

That creates the JAR file that I need to put in my application zip file to
distribute.  It also adds the runtime dependencies to my manifest.

Then in my acme-assembly.xml:


  1.0
  
tar.gz
  
  false
  

  target


  *.jar

  
  
  
  dist
  
*
  
   
  
  

  /
  false
  runtime

  


The dependencySets tag adds the runtime libraries to the root of my
tar.gzfile so when someone deploys it in a install directory, the
classpath
manifest entry is relative to the current path and everything just works.
When I do mvn package, I get a Acme-1.0.tar.gz with a acme.jar in it a long
with all of its runtime dependencies.  I ALSO in "dist" have a bunch of
other static files (think license, README, etc.) that gets picked up as
well.

Not sure if this is the absolute best way or only way, but this works for me
every time no hassles!

Let me know,

-aps

On 12/4/06, Eric Wang <[EMAIL PROTECTED]> wrote:
>
> Does your jar have any dependencies? If not, then your case is a
> little bit different from mine.
>
> My (maybe not so simple) command line application depends on two jars.
> If I just run "mvn package" I get a jar in the target directory like
> you. However that jar doesn't include my application's two
> dependencies. I have to distribute them separately in order to run my
> application.
>
> The assembly plugin's jar-with-dependencies descriptor seems designed
> to solve this problem by generating a self-contained jar containing
> all dependencies. I want to leverage this to generate a self-contained
> jar, and then zip that jar up along with various support files
> (readme, etc.).
>
> The approach I'm trying right now is to use the provided
> jar-with-dependencies descriptor along a custom descriptor. My pom
> looks something like this:
>
> maven-assembly-plugin
> 
> 
> jar-with-dependencies
> 
> 
> my-custom-descriptor.xml
>  
> 
>
> My custom descriptor is similar to yours. The problem is when I enter
> "mvn assembly:assembly" my custom descriptor is always processed
> first, before the jar-with-dependencies descriptor. Naturally, the
> self-contained jar doesn't exist yet, and I end up with a zip file
> full of support files, but no jar.
>
> In a sense, my custom descriptor depends on the jar-with-dependencies
> descriptor being run first, but I have no idea how to express this. I
> will look into creating multiple modules to see if it will solve my
> problem, however it seems somewhat overkill for my application.
>
> Thanks for your help Alexander.
>
>
> On 12/4/06, Alexander Sack <[EMAIL PROTECTED]> wrote:
> > I won't speak for best practices but typically you would create another
> > module to do the packaging (similar to some of the EAR examples).
> >
> > For a simple command-line application, my guess is one pom and one
> assembly
> > descriptor will be enough.  For my command-line tool I generate the jar
> and
> > then assemble the whole applicaiton like so:
> >
> > snippet from my assembly descriptor XML file:
> >
> > 
> > 
> >   target
> > 
> > 
> >   *.jar
> > 
> >   
> >   
> >   
> >   dist
> >   
> > *
> >   
> >
> >   
> >
> > Basically dist has some extra static files in it, target is where the
> JAR
> > gets built, and then the assembly plugin builds everything together.
> >
> >
> > -aps
>
> ---

Re: Including an assembly as part of another assembly

2006-12-04 Thread Alexander Sack

Eric, I have the eXACT same project.  My command line tool needs a couple of
runtime dependencies.

Let me show how I organize a project which works for me beautifully (maybe
this will help):


   
 acme-depedency-1
 acme-dpendency-1
 acme-dependency-1
   
   ..
   ..
   ..
 
 
   
   
 maven-compiler-plugin
 org.apache.maven.plugins
 
   1.5
   1.5
 
   

   maven-assembly-plugin
   2.0-beta-1
   
 src/main/assembly/acme-assembly.xml
 target
 target/assembly/work
 Acme
   
 
 
 org.apache.maven.plugins
 maven-jar-plugin
 
   
 
   true
 com.acme.main.class
 
   
   acme.jar
 
 
   
 

That creates the JAR file that I need to put in my application zip file to
distribute.  It also adds the runtime dependencies to my manifest.

Then in my acme-assembly.xml:


 1.0
 
   tar.gz
 
 false
 
   
 target
   
   
 *.jar
   
 
 
 
 dist
 
   *
 
  
 
 
   
 /
 false
 runtime
   
 


The dependencySets tag adds the runtime libraries to the root of my
tar.gzfile so when someone deploys it in a install directory, the
classpath
manifest entry is relative to the current path and everything just works.
When I do mvn package, I get a Acme-1.0.tar.gz with a acme.jar in it a long
with all of its runtime dependencies.  I ALSO in "dist" have a bunch of
other static files (think license, README, etc.) that gets picked up as
well.

Not sure if this is the absolute best way or only way, but this works for me
every time no hassles!

Let me know,

-aps

On 12/4/06, Eric Wang <[EMAIL PROTECTED]> wrote:


Does your jar have any dependencies? If not, then your case is a
little bit different from mine.

My (maybe not so simple) command line application depends on two jars.
If I just run "mvn package" I get a jar in the target directory like
you. However that jar doesn't include my application's two
dependencies. I have to distribute them separately in order to run my
application.

The assembly plugin's jar-with-dependencies descriptor seems designed
to solve this problem by generating a self-contained jar containing
all dependencies. I want to leverage this to generate a self-contained
jar, and then zip that jar up along with various support files
(readme, etc.).

The approach I'm trying right now is to use the provided
jar-with-dependencies descriptor along a custom descriptor. My pom
looks something like this:

maven-assembly-plugin


jar-with-dependencies


my-custom-descriptor.xml
 


My custom descriptor is similar to yours. The problem is when I enter
"mvn assembly:assembly" my custom descriptor is always processed
first, before the jar-with-dependencies descriptor. Naturally, the
self-contained jar doesn't exist yet, and I end up with a zip file
full of support files, but no jar.

In a sense, my custom descriptor depends on the jar-with-dependencies
descriptor being run first, but I have no idea how to express this. I
will look into creating multiple modules to see if it will solve my
problem, however it seems somewhat overkill for my application.

Thanks for your help Alexander.


On 12/4/06, Alexander Sack <[EMAIL PROTECTED]> wrote:
> I won't speak for best practices but typically you would create another
> module to do the packaging (similar to some of the EAR examples).
>
> For a simple command-line application, my guess is one pom and one
assembly
> descriptor will be enough.  For my command-line tool I generate the jar
and
> then assemble the whole applicaiton like so:
>
> snippet from my assembly descriptor XML file:
>
> 
> 
>   target
> 
> 
>   *.jar
> 
>   
>   
>   
>   dist
>   
> *
>   
>
>   
>
> Basically dist has some extra static files in it, target is where the
JAR
> gets built, and then the assembly plugin builds everything together.
>
>
> -aps

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
"What lies behind us and what lies in front of us is of little concern to
what lies within us." -Ralph Waldo Emerson


Re: Including an assembly as part of another assembly

2006-12-04 Thread Eric Wang

Does your jar have any dependencies? If not, then your case is a
little bit different from mine.

My (maybe not so simple) command line application depends on two jars.
If I just run "mvn package" I get a jar in the target directory like
you. However that jar doesn't include my application's two
dependencies. I have to distribute them separately in order to run my
application.

The assembly plugin's jar-with-dependencies descriptor seems designed
to solve this problem by generating a self-contained jar containing
all dependencies. I want to leverage this to generate a self-contained
jar, and then zip that jar up along with various support files
(readme, etc.).

The approach I'm trying right now is to use the provided
jar-with-dependencies descriptor along a custom descriptor. My pom
looks something like this:

maven-assembly-plugin
   
   
   jar-with-dependencies
   
   
   my-custom-descriptor.xml

   

My custom descriptor is similar to yours. The problem is when I enter
"mvn assembly:assembly" my custom descriptor is always processed
first, before the jar-with-dependencies descriptor. Naturally, the
self-contained jar doesn't exist yet, and I end up with a zip file
full of support files, but no jar.

In a sense, my custom descriptor depends on the jar-with-dependencies
descriptor being run first, but I have no idea how to express this. I
will look into creating multiple modules to see if it will solve my
problem, however it seems somewhat overkill for my application.

Thanks for your help Alexander.


On 12/4/06, Alexander Sack <[EMAIL PROTECTED]> wrote:

I won't speak for best practices but typically you would create another
module to do the packaging (similar to some of the EAR examples).

For a simple command-line application, my guess is one pom and one assembly
descriptor will be enough.  For my command-line tool I generate the jar and
then assemble the whole applicaiton like so:

snippet from my assembly descriptor XML file:



  target


  *.jar

  
  
  
  dist
  
*
  
   
  

Basically dist has some extra static files in it, target is where the JAR
gets built, and then the assembly plugin builds everything together.


-aps


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Including an assembly as part of another assembly

2006-12-04 Thread Alexander Sack

I won't speak for best practices but typically you would create another
module to do the packaging (similar to some of the EAR examples).

For a simple command-line application, my guess is one pom and one assembly
descriptor will be enough.  For my command-line tool I generate the jar and
then assemble the whole applicaiton like so:

snippet from my assembly descriptor XML file:


   
 target
   
   
 *.jar
   
 
 
 
 dist
 
   *
 
  
 

Basically dist has some extra static files in it, target is where the JAR
gets built, and then the assembly plugin builds everything together.


-aps

On 12/4/06, Eric Wang <[EMAIL PROTECTED]> wrote:


My project is a simple command-line application. I didn't think it
required multiple modules so I never looked into that. Is that the
preferred way to accomplish what I'm describing? Basically, I just
want to include my assembly jar along with a few other files inside a
zip file.


On 12/4/06, Alexander Sack <[EMAIL PROTECTED]> wrote:
> Quick question, why can't you have two sub modules under your POM, one
that
> generates an assembly, the other generating the final output with the
other
> assembly included?  (you get the idea)
>
> -aps
>
> On 12/4/06, Eric Wang <[EMAIL PROTECTED]> wrote:
> >
> > Hi, I'm new to Maven so forgive me if this something really obvious. I
> > looked through the assembly plugin documentation and searched the
> > archives, but couldn't find anything covering my use case.
> >
> > I'm building an assembly using the built-in "jar-with-dependencies"
> > descriptor. That works great. I'd like to include the generated
> > assembly inside another custom assembly. The custom assembly would be
> > a zip file containing my jar (generated with the
> > "jar-with-dependencies" descriptor) along with some other supporting
> > files located in my project root folder.
> >
> > Is something like this possible? I've tried messing around with my
> > custom descriptor, but to no avail. I can generate the zip file, but
> > it doesn't contain my jar, only the supporting files. If I'm going in
> > the wrong direction with this, I'd appreciate if someone could let me
> > know. Thanks.
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> "What lies behind us and what lies in front of us is of little concern
to
> what lies within us." -Ralph Waldo Emerson
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
"What lies behind us and what lies in front of us is of little concern to
what lies within us." -Ralph Waldo Emerson


Re: Including an assembly as part of another assembly

2006-12-04 Thread Eric Wang

My project is a simple command-line application. I didn't think it
required multiple modules so I never looked into that. Is that the
preferred way to accomplish what I'm describing? Basically, I just
want to include my assembly jar along with a few other files inside a
zip file.


On 12/4/06, Alexander Sack <[EMAIL PROTECTED]> wrote:

Quick question, why can't you have two sub modules under your POM, one that
generates an assembly, the other generating the final output with the other
assembly included?  (you get the idea)

-aps

On 12/4/06, Eric Wang <[EMAIL PROTECTED]> wrote:
>
> Hi, I'm new to Maven so forgive me if this something really obvious. I
> looked through the assembly plugin documentation and searched the
> archives, but couldn't find anything covering my use case.
>
> I'm building an assembly using the built-in "jar-with-dependencies"
> descriptor. That works great. I'd like to include the generated
> assembly inside another custom assembly. The custom assembly would be
> a zip file containing my jar (generated with the
> "jar-with-dependencies" descriptor) along with some other supporting
> files located in my project root folder.
>
> Is something like this possible? I've tried messing around with my
> custom descriptor, but to no avail. I can generate the zip file, but
> it doesn't contain my jar, only the supporting files. If I'm going in
> the wrong direction with this, I'd appreciate if someone could let me
> know. Thanks.
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


--
"What lies behind us and what lies in front of us is of little concern to
what lies within us." -Ralph Waldo Emerson




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Including an assembly as part of another assembly

2006-12-04 Thread Alexander Sack

Quick question, why can't you have two sub modules under your POM, one that
generates an assembly, the other generating the final output with the other
assembly included?  (you get the idea)

-aps

On 12/4/06, Eric Wang <[EMAIL PROTECTED]> wrote:


Hi, I'm new to Maven so forgive me if this something really obvious. I
looked through the assembly plugin documentation and searched the
archives, but couldn't find anything covering my use case.

I'm building an assembly using the built-in "jar-with-dependencies"
descriptor. That works great. I'd like to include the generated
assembly inside another custom assembly. The custom assembly would be
a zip file containing my jar (generated with the
"jar-with-dependencies" descriptor) along with some other supporting
files located in my project root folder.

Is something like this possible? I've tried messing around with my
custom descriptor, but to no avail. I can generate the zip file, but
it doesn't contain my jar, only the supporting files. If I'm going in
the wrong direction with this, I'd appreciate if someone could let me
know. Thanks.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
"What lies behind us and what lies in front of us is of little concern to
what lies within us." -Ralph Waldo Emerson