You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Brad O'Hearne <br...@neurofire.com> on 2006/03/07 06:04:23 UTC

How to reference a binary assembly dependency

Using the assembly plugin, I have created assembly jars, and deployed 
them to my snapshot repository. The problem is, I am not finding a way 
to reference this jar as a dependency. The assembly creates two jar 
files when run named:

MyApp-1.0-SNAPSHOT.jar
MyApp-1.0-SNAPSHOT-with-dependencies.jar

The second jar is the one which I need to use. In my dependent project, 
I have the following in my pom.xml:

<dependency>
    <groupId>com.me</groupId>
    <artifactId>MyApp</artifactId>
    <version>1.0-SNAPSHOT</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>

The problem is, this of course pulls the first jar, which does not 
contain the dependencies needed. So I changed my pom to this:

<dependency>
    <groupId>com.me</groupId>
    <artifactId>MyApp</artifactId>
    <version>1.0-SNAPSHOT-with-dependencies</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>

This time though, I get this error:

[INFO] Failed to resolve artifact.

required artifacts missing:
  com.me.MyApp:jar:1.0-SNAPSHOT-with-dependencies

The jar file is in my repository. How to I reference my assembly jar 
that contains a dependency? The descriptor file requires a value in the 
ID element, which becomes the suffix appended to your jar. Any ideas?

Brad

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


Re: How to reference a binary assembly dependency

Posted by dan tran <da...@gmail.com>.
<dependency>
   <groupId>com.me</groupId>
   <artifactId>MyApp</artifactId>
   <version>1.0-SNAPSHOT</version>
   <classifier>with-dependencies</classifer>
   <type>jar</type>
   <scope>compile</scope>
</dependency>



On 3/6/06, Brad O'Hearne <br...@neurofire.com> wrote:
>
> Using the assembly plugin, I have created assembly jars, and deployed
> them to my snapshot repository. The problem is, I am not finding a way
> to reference this jar as a dependency. The assembly creates two jar
> files when run named:
>
> MyApp-1.0-SNAPSHOT.jar
> MyApp-1.0-SNAPSHOT-with-dependencies.jar
>
> The second jar is the one which I need to use. In my dependent project,
> I have the following in my pom.xml:
>
> <dependency>
>    <groupId>com.me</groupId>
>    <artifactId>MyApp</artifactId>
>    <version>1.0-SNAPSHOT</version>
>    <type>jar</type>
>    <scope>compile</scope>
> </dependency>
>
> The problem is, this of course pulls the first jar, which does not
> contain the dependencies needed. So I changed my pom to this:
>
> <dependency>
>    <groupId>com.me</groupId>
>    <artifactId>MyApp</artifactId>
>    <version>1.0-SNAPSHOT-with-dependencies</version>
>    <type>jar</type>
>    <scope>compile</scope>
> </dependency>
>
> This time though, I get this error:
>
> [INFO] Failed to resolve artifact.
>
> required artifacts missing:
> com.me.MyApp:jar:1.0-SNAPSHOT-with-dependencies
>
> The jar file is in my repository. How to I reference my assembly jar
> that contains a dependency? The descriptor file requires a value in the
> ID element, which becomes the suffix appended to your jar. Any ideas?
>
> Brad
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: How to reference a binary assembly dependency

Posted by Wayne Fay <wa...@gmail.com>.
At this point, my group doesn't build "standalone ejb" packages.

Personally, we package our J2EE projects as follows...
ear
>ejb (dep on sharedlib)
>war (dep on sharedlib, ejb)
>sharedlib (dep on commons-logging, etc)
>commons-logging
>etc

Then I have this in all my jar packaged modules pom.xml files:
<builds>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <addClasspath>true</addClasspath>

This adds the classpath entries to manifest file so the
commons-logging etc in the EAR can be accessed and used by sharedlib,
ejb, war while only being packaged once in the build file.

I don't know, perhaps this is what you're looking for in your EJB
packaging rather than the jar with uberjars inside?

Wayne


On 3/6/06, Brad O'Hearne <br...@neurofire.com> wrote:
> The use case is a standard j2ee EJB jar. It is a modular, self
> contained, EJB jar. It must contain EJB classes and all of their
> dependencies. So if I have com.me.EJBClass1 that depends on log4j.jar,
> my ejb jar needs to contain EJBClass1 and log4j.jar. This apparently
> cannot be accomplished with the standard jar plugin, but has to happen
> from the assembly plugin. Why the assembly plugin builds the original
> jar without dependencies, I don't know, but it does. The important thing
> is that the with dependencies works.
>
> Brad
>
> Wayne Fay wrote:
>
> >That's actually what I was getting at...
> >
> >It sounds like he wants to pack an uberjar into another jar. I just
> >don't see that as a valid use case.
> >
> >I completely understand the uberjar use case!!
> >
> >Wayne
> >
> >
> >On 3/6/06, Brett Porter <br...@gmail.com> wrote:
> >
> >
> >>This isn't routing around it: it seems to be a common use case
> >>(usually, the incorporated jars are unpacked into the other one since
> >>its impossible to use jars in jars as is).
> >>
> >>However, there is a limitation that the transitive dependencies will
> >>still be pulled in, even though the jars are included in the jar. Not
> >>sure if that will bit in this scenario or not - if they are not
> >>unpacked, then I'd say not.
> >>
> >>- Brett
> >>
> >>On 3/7/06, Wayne Fay <wa...@gmail.com> wrote:
> >>
> >>
> >>>I think you need a classifier. ;-)
> >>>
> >>><dependency>
> >>>   <groupId>com.me</groupId>
> >>>   <artifactId>MyApp</artifactId>
> >>>   <version>1.0-SNAPSHOT</version>
> >>>   <classifier>with-dependencies</classifier>
> >>>   <type>jar</type>
> >>>   <scope>compile</scope>
> >>></dependency>
> >>>
> >>>Let us know if this works!
> >>>
> >>>Of course, I have to ask why you are doing this, effectively routing
> >>>around the built-in dependency management features of Maven...
> >>>
> >>>Wayne
> >>>
> >>>On 3/6/06, Brad O'Hearne <br...@neurofire.com> wrote:
> >>>
> >>>
> >>>>Using the assembly plugin, I have created assembly jars, and deployed
> >>>>them to my snapshot repository. The problem is, I am not finding a way
> >>>>to reference this jar as a dependency. The assembly creates two jar
> >>>>files when run named:
> >>>>
> >>>>MyApp-1.0-SNAPSHOT.jar
> >>>>MyApp-1.0-SNAPSHOT-with-dependencies.jar
> >>>>
> >>>>The second jar is the one which I need to use. In my dependent project,
> >>>>I have the following in my pom.xml:
> >>>>
> >>>><dependency>
> >>>>   <groupId>com.me</groupId>
> >>>>   <artifactId>MyApp</artifactId>
> >>>>   <version>1.0-SNAPSHOT</version>
> >>>>   <type>jar</type>
> >>>>   <scope>compile</scope>
> >>>></dependency>
> >>>>
> >>>>The problem is, this of course pulls the first jar, which does not
> >>>>contain the dependencies needed. So I changed my pom to this:
> >>>>
> >>>><dependency>
> >>>>   <groupId>com.me</groupId>
> >>>>   <artifactId>MyApp</artifactId>
> >>>>   <version>1.0-SNAPSHOT-with-dependencies</version>
> >>>>   <type>jar</type>
> >>>>   <scope>compile</scope>
> >>>></dependency>
> >>>>
> >>>>This time though, I get this error:
> >>>>
> >>>>[INFO] Failed to resolve artifact.
> >>>>
> >>>>required artifacts missing:
> >>>> com.me.MyApp:jar:1.0-SNAPSHOT-with-dependencies
> >>>>
> >>>>The jar file is in my repository. How to I reference my assembly jar
> >>>>that contains a dependency? The descriptor file requires a value in the
> >>>>ID element, which becomes the suffix appended to your jar. Any ideas?
> >>>>
> >>>>Brad
> >>>>
> >>>>---------------------------------------------------------------------
> >>>>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
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> 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: How to reference a binary assembly dependency

Posted by Brad O'Hearne <br...@neurofire.com>.
The use case is a standard j2ee EJB jar. It is a modular, self 
contained, EJB jar. It must contain EJB classes and all of their 
dependencies. So if I have com.me.EJBClass1 that depends on log4j.jar, 
my ejb jar needs to contain EJBClass1 and log4j.jar. This apparently 
cannot be accomplished with the standard jar plugin, but has to happen 
from the assembly plugin. Why the assembly plugin builds the original 
jar without dependencies, I don't know, but it does. The important thing 
is that the with dependencies works.

Brad

Wayne Fay wrote:

>That's actually what I was getting at...
>
>It sounds like he wants to pack an uberjar into another jar. I just
>don't see that as a valid use case.
>
>I completely understand the uberjar use case!!
>
>Wayne
>
>
>On 3/6/06, Brett Porter <br...@gmail.com> wrote:
>  
>
>>This isn't routing around it: it seems to be a common use case
>>(usually, the incorporated jars are unpacked into the other one since
>>its impossible to use jars in jars as is).
>>
>>However, there is a limitation that the transitive dependencies will
>>still be pulled in, even though the jars are included in the jar. Not
>>sure if that will bit in this scenario or not - if they are not
>>unpacked, then I'd say not.
>>
>>- Brett
>>
>>On 3/7/06, Wayne Fay <wa...@gmail.com> wrote:
>>    
>>
>>>I think you need a classifier. ;-)
>>>
>>><dependency>
>>>   <groupId>com.me</groupId>
>>>   <artifactId>MyApp</artifactId>
>>>   <version>1.0-SNAPSHOT</version>
>>>   <classifier>with-dependencies</classifier>
>>>   <type>jar</type>
>>>   <scope>compile</scope>
>>></dependency>
>>>
>>>Let us know if this works!
>>>
>>>Of course, I have to ask why you are doing this, effectively routing
>>>around the built-in dependency management features of Maven...
>>>
>>>Wayne
>>>
>>>On 3/6/06, Brad O'Hearne <br...@neurofire.com> wrote:
>>>      
>>>
>>>>Using the assembly plugin, I have created assembly jars, and deployed
>>>>them to my snapshot repository. The problem is, I am not finding a way
>>>>to reference this jar as a dependency. The assembly creates two jar
>>>>files when run named:
>>>>
>>>>MyApp-1.0-SNAPSHOT.jar
>>>>MyApp-1.0-SNAPSHOT-with-dependencies.jar
>>>>
>>>>The second jar is the one which I need to use. In my dependent project,
>>>>I have the following in my pom.xml:
>>>>
>>>><dependency>
>>>>   <groupId>com.me</groupId>
>>>>   <artifactId>MyApp</artifactId>
>>>>   <version>1.0-SNAPSHOT</version>
>>>>   <type>jar</type>
>>>>   <scope>compile</scope>
>>>></dependency>
>>>>
>>>>The problem is, this of course pulls the first jar, which does not
>>>>contain the dependencies needed. So I changed my pom to this:
>>>>
>>>><dependency>
>>>>   <groupId>com.me</groupId>
>>>>   <artifactId>MyApp</artifactId>
>>>>   <version>1.0-SNAPSHOT-with-dependencies</version>
>>>>   <type>jar</type>
>>>>   <scope>compile</scope>
>>>></dependency>
>>>>
>>>>This time though, I get this error:
>>>>
>>>>[INFO] Failed to resolve artifact.
>>>>
>>>>required artifacts missing:
>>>> com.me.MyApp:jar:1.0-SNAPSHOT-with-dependencies
>>>>
>>>>The jar file is in my repository. How to I reference my assembly jar
>>>>that contains a dependency? The descriptor file requires a value in the
>>>>ID element, which becomes the suffix appended to your jar. Any ideas?
>>>>
>>>>Brad
>>>>
>>>>---------------------------------------------------------------------
>>>>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
>
>  
>


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


Re: How to reference a binary assembly dependency

Posted by Wayne Fay <wa...@gmail.com>.
That's actually what I was getting at...

It sounds like he wants to pack an uberjar into another jar. I just
don't see that as a valid use case.

I completely understand the uberjar use case!!

Wayne


On 3/6/06, Brett Porter <br...@gmail.com> wrote:
> This isn't routing around it: it seems to be a common use case
> (usually, the incorporated jars are unpacked into the other one since
> its impossible to use jars in jars as is).
>
> However, there is a limitation that the transitive dependencies will
> still be pulled in, even though the jars are included in the jar. Not
> sure if that will bit in this scenario or not - if they are not
> unpacked, then I'd say not.
>
> - Brett
>
> On 3/7/06, Wayne Fay <wa...@gmail.com> wrote:
> > I think you need a classifier. ;-)
> >
> > <dependency>
> >    <groupId>com.me</groupId>
> >    <artifactId>MyApp</artifactId>
> >    <version>1.0-SNAPSHOT</version>
> >    <classifier>with-dependencies</classifier>
> >    <type>jar</type>
> >    <scope>compile</scope>
> > </dependency>
> >
> > Let us know if this works!
> >
> > Of course, I have to ask why you are doing this, effectively routing
> > around the built-in dependency management features of Maven...
> >
> > Wayne
> >
> > On 3/6/06, Brad O'Hearne <br...@neurofire.com> wrote:
> > > Using the assembly plugin, I have created assembly jars, and deployed
> > > them to my snapshot repository. The problem is, I am not finding a way
> > > to reference this jar as a dependency. The assembly creates two jar
> > > files when run named:
> > >
> > > MyApp-1.0-SNAPSHOT.jar
> > > MyApp-1.0-SNAPSHOT-with-dependencies.jar
> > >
> > > The second jar is the one which I need to use. In my dependent project,
> > > I have the following in my pom.xml:
> > >
> > > <dependency>
> > >    <groupId>com.me</groupId>
> > >    <artifactId>MyApp</artifactId>
> > >    <version>1.0-SNAPSHOT</version>
> > >    <type>jar</type>
> > >    <scope>compile</scope>
> > > </dependency>
> > >
> > > The problem is, this of course pulls the first jar, which does not
> > > contain the dependencies needed. So I changed my pom to this:
> > >
> > > <dependency>
> > >    <groupId>com.me</groupId>
> > >    <artifactId>MyApp</artifactId>
> > >    <version>1.0-SNAPSHOT-with-dependencies</version>
> > >    <type>jar</type>
> > >    <scope>compile</scope>
> > > </dependency>
> > >
> > > This time though, I get this error:
> > >
> > > [INFO] Failed to resolve artifact.
> > >
> > > required artifacts missing:
> > >  com.me.MyApp:jar:1.0-SNAPSHOT-with-dependencies
> > >
> > > The jar file is in my repository. How to I reference my assembly jar
> > > that contains a dependency? The descriptor file requires a value in the
> > > ID element, which becomes the suffix appended to your jar. Any ideas?
> > >
> > > Brad
> > >
> > > ---------------------------------------------------------------------
> > > 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: How to reference a binary assembly dependency

Posted by Brett Porter <br...@gmail.com>.
This isn't routing around it: it seems to be a common use case
(usually, the incorporated jars are unpacked into the other one since
its impossible to use jars in jars as is).

However, there is a limitation that the transitive dependencies will
still be pulled in, even though the jars are included in the jar. Not
sure if that will bit in this scenario or not - if they are not
unpacked, then I'd say not.

- Brett

On 3/7/06, Wayne Fay <wa...@gmail.com> wrote:
> I think you need a classifier. ;-)
>
> <dependency>
>    <groupId>com.me</groupId>
>    <artifactId>MyApp</artifactId>
>    <version>1.0-SNAPSHOT</version>
>    <classifier>with-dependencies</classifier>
>    <type>jar</type>
>    <scope>compile</scope>
> </dependency>
>
> Let us know if this works!
>
> Of course, I have to ask why you are doing this, effectively routing
> around the built-in dependency management features of Maven...
>
> Wayne
>
> On 3/6/06, Brad O'Hearne <br...@neurofire.com> wrote:
> > Using the assembly plugin, I have created assembly jars, and deployed
> > them to my snapshot repository. The problem is, I am not finding a way
> > to reference this jar as a dependency. The assembly creates two jar
> > files when run named:
> >
> > MyApp-1.0-SNAPSHOT.jar
> > MyApp-1.0-SNAPSHOT-with-dependencies.jar
> >
> > The second jar is the one which I need to use. In my dependent project,
> > I have the following in my pom.xml:
> >
> > <dependency>
> >    <groupId>com.me</groupId>
> >    <artifactId>MyApp</artifactId>
> >    <version>1.0-SNAPSHOT</version>
> >    <type>jar</type>
> >    <scope>compile</scope>
> > </dependency>
> >
> > The problem is, this of course pulls the first jar, which does not
> > contain the dependencies needed. So I changed my pom to this:
> >
> > <dependency>
> >    <groupId>com.me</groupId>
> >    <artifactId>MyApp</artifactId>
> >    <version>1.0-SNAPSHOT-with-dependencies</version>
> >    <type>jar</type>
> >    <scope>compile</scope>
> > </dependency>
> >
> > This time though, I get this error:
> >
> > [INFO] Failed to resolve artifact.
> >
> > required artifacts missing:
> >  com.me.MyApp:jar:1.0-SNAPSHOT-with-dependencies
> >
> > The jar file is in my repository. How to I reference my assembly jar
> > that contains a dependency? The descriptor file requires a value in the
> > ID element, which becomes the suffix appended to your jar. Any ideas?
> >
> > Brad
> >
> > ---------------------------------------------------------------------
> > 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: How to reference a binary assembly dependency

Posted by Wayne Fay <wa...@gmail.com>.
I think you need a classifier. ;-)

<dependency>
   <groupId>com.me</groupId>
   <artifactId>MyApp</artifactId>
   <version>1.0-SNAPSHOT</version>
   <classifier>with-dependencies</classifier>
   <type>jar</type>
   <scope>compile</scope>
</dependency>

Let us know if this works!

Of course, I have to ask why you are doing this, effectively routing
around the built-in dependency management features of Maven...

Wayne

On 3/6/06, Brad O'Hearne <br...@neurofire.com> wrote:
> Using the assembly plugin, I have created assembly jars, and deployed
> them to my snapshot repository. The problem is, I am not finding a way
> to reference this jar as a dependency. The assembly creates two jar
> files when run named:
>
> MyApp-1.0-SNAPSHOT.jar
> MyApp-1.0-SNAPSHOT-with-dependencies.jar
>
> The second jar is the one which I need to use. In my dependent project,
> I have the following in my pom.xml:
>
> <dependency>
>    <groupId>com.me</groupId>
>    <artifactId>MyApp</artifactId>
>    <version>1.0-SNAPSHOT</version>
>    <type>jar</type>
>    <scope>compile</scope>
> </dependency>
>
> The problem is, this of course pulls the first jar, which does not
> contain the dependencies needed. So I changed my pom to this:
>
> <dependency>
>    <groupId>com.me</groupId>
>    <artifactId>MyApp</artifactId>
>    <version>1.0-SNAPSHOT-with-dependencies</version>
>    <type>jar</type>
>    <scope>compile</scope>
> </dependency>
>
> This time though, I get this error:
>
> [INFO] Failed to resolve artifact.
>
> required artifacts missing:
>  com.me.MyApp:jar:1.0-SNAPSHOT-with-dependencies
>
> The jar file is in my repository. How to I reference my assembly jar
> that contains a dependency? The descriptor file requires a value in the
> ID element, which becomes the suffix appended to your jar. Any ideas?
>
> Brad
>
> ---------------------------------------------------------------------
> 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