You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "krishnan.1000" <kr...@gmail.com> on 2008/03/07 03:37:42 UTC

Maven Assembly for MultiModule project

Hi,

I am a Maven newbie and I hope this is not a stupid question.  I am trying
to create two Maven assembly jars for modules Foo and Bar. My project --
	 |
	 |------- Bar
         |------- Foo
         |--------Foo-A
         |------- Foo-B


This is my project structure. In this project, FOO-A is dependent on Foo-B
and Bar ,Foo are dependent upon FOO-A. I am trying to build assembly jars
for both the for both Foo and Bar modules. Can you please help me?

My project pom is as follows.

<modules>
    <module>Bar</module>
    <module>Foo</module>
    <module>Foo-A</module>
    <module>Foo-B</module>
  </modules>
  
  <dependencies>    
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.13</version>
      <scope>compile</scope>      
    </dependency>
    
    ......
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>assembly.xml</descriptor>
          </descriptors>
          <tarLongFileMode>gnu</tarLongFileMode>
        </configuration>
      </plugin>
  </build>
  
  <pluginRepositories>
    <pluginRepository>
      <id>apache.snapshots</id>
      <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
    </pluginRepository>
  </pluginRepositories>

My assembly.xml

<assembly>
  <id>jar-with-dependencies</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
    <fileSet>
      <directory>target/classes</directory>
      <outputDirectory>/</outputDirectory>
    </fileSet>
  </fileSets>
  <dependencySets>
    <dependencySet>
      <outputDirectory>/</outputDirectory>
      <unpack>false</unpack>
      <scope>runtime</scope>
    </dependencySet>
  </dependencySets>
</assembly>


-- 
View this message in context: http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s177p15885942.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


RE: Maven Assembly for MultiModule project

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
Check out the free book[1], this can be read in a few hours and should
get you up to speed quickly.

[1] http://www.sonatype.com/book

-----Original Message-----
From: krishnan.1000 [mailto:krishnan.1000@gmail.com] 
Sent: Friday, March 07, 2008 1:14 PM
To: users@maven.apache.org
Subject: Re: Maven Assembly for MultiModule project


Hi Wayne,

I can not help it. I just joined a project to replace a guy who left the
project. So I am on an accelerated learning curve.

Thanks,

Karthik

Wayne Fay wrote:
> 
> It sounds like you're jumping in to complex builds with Maven2 without
> really understanding how things work at a basic level. As an example
> of this, you're running mvn install:install-file etc on what seems to
> be a Maven project -- so you really only need to type "mvn install".
> The same thing goes for your comment about "adding dependencies in all
> the pom.xml even if they have been specified in the parent." So I
> think you've skipped some important steps in your learning process.
> 
> I would go back to the beginning and work your way through Better
> Builds With Maven (free pdf book from devzuz.com) and Maven: The
> Definitive Guide (from sonatype.com). The books are organized such
> that you start out learning how Maven works internally (generally),
> and then they lead through some basic examples and finally take you
> through much more involved examples.
> 
> You should be able to do this in just 1 or 2 days, and I think you
> really need to invest this time now rather than attempting to hack
> your poms and assemblies just to make it work.
> 
> Wayne
> 
> On 3/7/08, krishnan.1000 <kr...@gmail.com> wrote:
>>
>>  <build>
>>    <plugins>
>>       <plugin>
>>        <artifactId>maven-compiler-plugin</artifactId>
>>        <version>2.1-20080129.223043-7</version>
>>        <configuration>
>>          <source>1.5</source>
>>          <target>1.5</target>
>>        </configuration>
>>      </plugin>
>>      <!--  TestNg plugin -->
>>     <plugin>
>>        <groupId>org.apache.maven.plugins</groupId>
>>        <artifactId>maven-surefire-plugin</artifactId>
>>        <version>2.4</version>
>>        <configuration>
>>          <suiteXmlFiles>
>>            <suiteXmlFile>testng.xml</suiteXmlFile>
>>          </suiteXmlFiles>
>>        </configuration>
>>      </plugin>
>>      <plugin>
>>        <artifactId>maven-assembly-plugin</artifactId>
>>        <configuration>
>>          <descriptorRefs>
>>            <descriptorRef>jar-with-dependencies</descriptorRef>
>>          </descriptorRefs>
>>          <archive>
>>            <manifest>
>>              <addClasspath>true</addClasspath>
>>              <mainClass>com.jbe.core.Foo</mainClass>
>>            </manifest>
>>          </archive>
>>        </configuration>
>>      </plugin>
>>    </plugins>
>>  </build>
>>
>> <parent>
>>    <relativePath>../pom.xml</relativePath>
>>    <version>0.1</version>
>>    <artifactId>foo-foo</artifactId>
>>    <groupId>foo</groupId>
>>  </parent>
>>
>> I also find that I have to include foo-b in my foo's pom.xml in order
to
>> compile even though, foo-a is dependent on foo-b and therefore must
>> compile
>> foo-b before foo-a.
>> <dependencies>
>>  <dependency>
>>      <groupId>foo</groupId>
>>      <artifactId>foo-a</artifactId>
>>      <version>${project.version}</version>
>>      <scope>compile</scope>
>>    </dependency>
>> <dependency>
>>      <groupId>foo</groupId>
>>      <artifactId>foo-b</artifactId>
>>      <version>${project.version}</version>
>>      <scope>compile</scope>
>> </dependency>
>> /dependencies>
>>
>> In addition, I have to add dependencies in all the pom.xml even if
they
>> have
>> been specified in the parent pom.xml.
>>
>> Thanks,
>>
>> Karthik Krishnan
>>
>>
>>
>> krishnan.1000 wrote:
>> >
>> > Hi Wayne,
>> >
>> > I am sorry Wayne. I should have been more specific on the post. To
>> answer
>> > your first comment,  and I do not wish to sound rude, but if I knew
>> what I
>> > was doing wrong, I would not have posted in the first place.
>> >
>> > 2. I am trying to assemble a jar of module Foo and Bar . I wish
that I
>> > create an executable jar with a defined main class and a classpath
>> added
>> > to MANIFEST.MF. So basically i want the to create foo.jar and
bar.jar
>> > containing all the dependencies.
>> >
>> > 3. I find  that if i make the changes in Foo-A or FooB java
classes,
>> and
>> > if i execute a mvn assembly:assembly, it does not build the FOO-A
or
>> FOO-B
>> > in the .m2 repository before building Foo and Bar successfully
again I
>> > have to get around that by doing the following
>> >
>> > mvn install:install-file
>> > -Dfile=/home/krishnan/project/foo-a/target/foo-a-0.1.jar
>> -DgroupId=project
>> > -DartifactId=foo-a -Dversion=0.1 -Dpackaging=jar
-DgeneratePOM=true,
>> the
>> > solution I found by doing a search on one of the posts.
>> >
>> > and again for foo-b. I would like to avoid that and just have mvn
>> > assembly:assembly do all this before creating foo.jar and bar.jar.
>> >
>> >
>> >
>> > Wayne Fay wrote:
>> >>
>> >> This list really works better if you post what you've done and
then
>> >> tell us why its not working the way you wanted, or an error
message
>> >> you got, etc. Looking at what you sent, I have no idea if it is
>> >> working how you expect or not.
>> >>
>> >> Sending your pom and assembly.xml file is probably not going to
give
>> >> you the results you are hoping for. So, send a reply and be more
clear
>> >> about what you've got vs what you want etc.
>> >>
>> >> Wayne
>> >>
>> >> On 3/6/08, krishnan.1000 <kr...@gmail.com> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> I am a Maven newbie and I hope this is not a stupid question.  I
am
>> >>> trying
>> >>> to create two Maven assembly jars for modules Foo and Bar. My
project
>> --
>> >>>         |
>> >>>         |------- Bar
>> >>>         |------- Foo
>> >>>         |--------Foo-A
>> >>>         |------- Foo-B
>> >>>
>> >>>
>> >>> This is my project structure. In this project, FOO-A is dependent
on
>> >>> Foo-B
>> >>> and Bar ,Foo are dependent upon FOO-A. I am trying to build
assembly
>> >>> jars
>> >>> for both the for both Foo and Bar modules. Can you please help
me?
>> >>>
>> >>> My project pom is as follows.
>> >>>
>> >>> <modules>
>> >>>    <module>Bar</module>
>> >>>    <module>Foo</module>
>> >>>    <module>Foo-A</module>
>> >>>    <module>Foo-B</module>
>> >>>  </modules>
>> >>>
>> >>>  <dependencies>
>> >>>    <dependency>
>> >>>      <groupId>log4j</groupId>
>> >>>      <artifactId>log4j</artifactId>
>> >>>      <version>1.2.13</version>
>> >>>      <scope>compile</scope>
>> >>>    </dependency>
>> >>>
>> >>>    ......
>> >>>  </dependencies>
>> >>>
>> >>>  <build>
>> >>>    <plugins>
>> >>>      <plugin>
>> >>>        <artifactId>maven-assembly-plugin</artifactId>
>> >>>        <configuration>
>> >>>          <descriptors>
>> >>>            <descriptor>assembly.xml</descriptor>
>> >>>          </descriptors>
>> >>>          <tarLongFileMode>gnu</tarLongFileMode>
>> >>>        </configuration>
>> >>>      </plugin>
>> >>>  </build>
>> >>>
>> >>>  <pluginRepositories>
>> >>>    <pluginRepository>
>> >>>      <id>apache.snapshots</id>
>> >>>
<url>http://people.apache.org/repo/m2-snapshot-repository/</url>
>> >>>    </pluginRepository>
>> >>>  </pluginRepositories>
>> >>>
>> >>> My assembly.xml
>> >>>
>> >>> <assembly>
>> >>>  <id>jar-with-dependencies</id>
>> >>>  <formats>
>> >>>    <format>jar</format>
>> >>>  </formats>
>> >>>  <includeBaseDirectory>false</includeBaseDirectory>
>> >>>  <fileSets>
>> >>>    <fileSet>
>> >>>      <directory>target/classes</directory>
>> >>>      <outputDirectory>/</outputDirectory>
>> >>>    </fileSet>
>> >>>  </fileSets>
>> >>>  <dependencySets>
>> >>>    <dependencySet>
>> >>>      <outputDirectory>/</outputDirectory>
>> >>>      <unpack>false</unpack>
>> >>>      <scope>runtime</scope>
>> >>>    </dependencySet>
>> >>>  </dependencySets>
>> >>> </assembly>
>> >>>
>> >>>
>> >>> --
>> >>> View this message in context:
>> >>>
>>
http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s
177p15885942.html
>> >>> Sent from the Maven - Users mailing list archive at Nabble.com.
>> >>>
>> >>>
>> >>>
---------------------------------------------------------------------
>> >>> 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
>> >>
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s
177p15890673.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s
177p15902134.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
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: Maven Assembly for MultiModule project

Posted by "krishnan.1000" <kr...@gmail.com>.
Hi Wayne,

I can not help it. I just joined a project to replace a guy who left the
project. So I am on an accelerated learning curve.

Thanks,

Karthik

Wayne Fay wrote:
> 
> It sounds like you're jumping in to complex builds with Maven2 without
> really understanding how things work at a basic level. As an example
> of this, you're running mvn install:install-file etc on what seems to
> be a Maven project -- so you really only need to type "mvn install".
> The same thing goes for your comment about "adding dependencies in all
> the pom.xml even if they have been specified in the parent." So I
> think you've skipped some important steps in your learning process.
> 
> I would go back to the beginning and work your way through Better
> Builds With Maven (free pdf book from devzuz.com) and Maven: The
> Definitive Guide (from sonatype.com). The books are organized such
> that you start out learning how Maven works internally (generally),
> and then they lead through some basic examples and finally take you
> through much more involved examples.
> 
> You should be able to do this in just 1 or 2 days, and I think you
> really need to invest this time now rather than attempting to hack
> your poms and assemblies just to make it work.
> 
> Wayne
> 
> On 3/7/08, krishnan.1000 <kr...@gmail.com> wrote:
>>
>>  <build>
>>    <plugins>
>>       <plugin>
>>        <artifactId>maven-compiler-plugin</artifactId>
>>        <version>2.1-20080129.223043-7</version>
>>        <configuration>
>>          <source>1.5</source>
>>          <target>1.5</target>
>>        </configuration>
>>      </plugin>
>>      <!--  TestNg plugin -->
>>     <plugin>
>>        <groupId>org.apache.maven.plugins</groupId>
>>        <artifactId>maven-surefire-plugin</artifactId>
>>        <version>2.4</version>
>>        <configuration>
>>          <suiteXmlFiles>
>>            <suiteXmlFile>testng.xml</suiteXmlFile>
>>          </suiteXmlFiles>
>>        </configuration>
>>      </plugin>
>>      <plugin>
>>        <artifactId>maven-assembly-plugin</artifactId>
>>        <configuration>
>>          <descriptorRefs>
>>            <descriptorRef>jar-with-dependencies</descriptorRef>
>>          </descriptorRefs>
>>          <archive>
>>            <manifest>
>>              <addClasspath>true</addClasspath>
>>              <mainClass>com.jbe.core.Foo</mainClass>
>>            </manifest>
>>          </archive>
>>        </configuration>
>>      </plugin>
>>    </plugins>
>>  </build>
>>
>> <parent>
>>    <relativePath>../pom.xml</relativePath>
>>    <version>0.1</version>
>>    <artifactId>foo-foo</artifactId>
>>    <groupId>foo</groupId>
>>  </parent>
>>
>> I also find that I have to include foo-b in my foo's pom.xml in order to
>> compile even though, foo-a is dependent on foo-b and therefore must
>> compile
>> foo-b before foo-a.
>> <dependencies>
>>  <dependency>
>>      <groupId>foo</groupId>
>>      <artifactId>foo-a</artifactId>
>>      <version>${project.version}</version>
>>      <scope>compile</scope>
>>    </dependency>
>> <dependency>
>>      <groupId>foo</groupId>
>>      <artifactId>foo-b</artifactId>
>>      <version>${project.version}</version>
>>      <scope>compile</scope>
>> </dependency>
>> /dependencies>
>>
>> In addition, I have to add dependencies in all the pom.xml even if they
>> have
>> been specified in the parent pom.xml.
>>
>> Thanks,
>>
>> Karthik Krishnan
>>
>>
>>
>> krishnan.1000 wrote:
>> >
>> > Hi Wayne,
>> >
>> > I am sorry Wayne. I should have been more specific on the post. To
>> answer
>> > your first comment,  and I do not wish to sound rude, but if I knew
>> what I
>> > was doing wrong, I would not have posted in the first place.
>> >
>> > 2. I am trying to assemble a jar of module Foo and Bar . I wish that I
>> > create an executable jar with a defined main class and a classpath
>> added
>> > to MANIFEST.MF. So basically i want the to create foo.jar and bar.jar
>> > containing all the dependencies.
>> >
>> > 3. I find  that if i make the changes in Foo-A or FooB java classes,
>> and
>> > if i execute a mvn assembly:assembly, it does not build the FOO-A or
>> FOO-B
>> > in the .m2 repository before building Foo and Bar successfully again I
>> > have to get around that by doing the following
>> >
>> > mvn install:install-file
>> > -Dfile=/home/krishnan/project/foo-a/target/foo-a-0.1.jar
>> -DgroupId=project
>> > -DartifactId=foo-a -Dversion=0.1 -Dpackaging=jar -DgeneratePOM=true,
>> the
>> > solution I found by doing a search on one of the posts.
>> >
>> > and again for foo-b. I would like to avoid that and just have mvn
>> > assembly:assembly do all this before creating foo.jar and bar.jar.
>> >
>> >
>> >
>> > Wayne Fay wrote:
>> >>
>> >> This list really works better if you post what you've done and then
>> >> tell us why its not working the way you wanted, or an error message
>> >> you got, etc. Looking at what you sent, I have no idea if it is
>> >> working how you expect or not.
>> >>
>> >> Sending your pom and assembly.xml file is probably not going to give
>> >> you the results you are hoping for. So, send a reply and be more clear
>> >> about what you've got vs what you want etc.
>> >>
>> >> Wayne
>> >>
>> >> On 3/6/08, krishnan.1000 <kr...@gmail.com> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> I am a Maven newbie and I hope this is not a stupid question.  I am
>> >>> trying
>> >>> to create two Maven assembly jars for modules Foo and Bar. My project
>> --
>> >>>         |
>> >>>         |------- Bar
>> >>>         |------- Foo
>> >>>         |--------Foo-A
>> >>>         |------- Foo-B
>> >>>
>> >>>
>> >>> This is my project structure. In this project, FOO-A is dependent on
>> >>> Foo-B
>> >>> and Bar ,Foo are dependent upon FOO-A. I am trying to build assembly
>> >>> jars
>> >>> for both the for both Foo and Bar modules. Can you please help me?
>> >>>
>> >>> My project pom is as follows.
>> >>>
>> >>> <modules>
>> >>>    <module>Bar</module>
>> >>>    <module>Foo</module>
>> >>>    <module>Foo-A</module>
>> >>>    <module>Foo-B</module>
>> >>>  </modules>
>> >>>
>> >>>  <dependencies>
>> >>>    <dependency>
>> >>>      <groupId>log4j</groupId>
>> >>>      <artifactId>log4j</artifactId>
>> >>>      <version>1.2.13</version>
>> >>>      <scope>compile</scope>
>> >>>    </dependency>
>> >>>
>> >>>    ......
>> >>>  </dependencies>
>> >>>
>> >>>  <build>
>> >>>    <plugins>
>> >>>      <plugin>
>> >>>        <artifactId>maven-assembly-plugin</artifactId>
>> >>>        <configuration>
>> >>>          <descriptors>
>> >>>            <descriptor>assembly.xml</descriptor>
>> >>>          </descriptors>
>> >>>          <tarLongFileMode>gnu</tarLongFileMode>
>> >>>        </configuration>
>> >>>      </plugin>
>> >>>  </build>
>> >>>
>> >>>  <pluginRepositories>
>> >>>    <pluginRepository>
>> >>>      <id>apache.snapshots</id>
>> >>>      <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
>> >>>    </pluginRepository>
>> >>>  </pluginRepositories>
>> >>>
>> >>> My assembly.xml
>> >>>
>> >>> <assembly>
>> >>>  <id>jar-with-dependencies</id>
>> >>>  <formats>
>> >>>    <format>jar</format>
>> >>>  </formats>
>> >>>  <includeBaseDirectory>false</includeBaseDirectory>
>> >>>  <fileSets>
>> >>>    <fileSet>
>> >>>      <directory>target/classes</directory>
>> >>>      <outputDirectory>/</outputDirectory>
>> >>>    </fileSet>
>> >>>  </fileSets>
>> >>>  <dependencySets>
>> >>>    <dependencySet>
>> >>>      <outputDirectory>/</outputDirectory>
>> >>>      <unpack>false</unpack>
>> >>>      <scope>runtime</scope>
>> >>>    </dependencySet>
>> >>>  </dependencySets>
>> >>> </assembly>
>> >>>
>> >>>
>> >>> --
>> >>> View this message in context:
>> >>>
>> http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s177p15885942.html
>> >>> Sent from the Maven - Users mailing list archive at Nabble.com.
>> >>>
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> 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
>> >>
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s177p15890673.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s177p15902134.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Maven Assembly for MultiModule project

Posted by Wayne Fay <wa...@gmail.com>.
It sounds like you're jumping in to complex builds with Maven2 without
really understanding how things work at a basic level. As an example
of this, you're running mvn install:install-file etc on what seems to
be a Maven project -- so you really only need to type "mvn install".
The same thing goes for your comment about "adding dependencies in all
the pom.xml even if they have been specified in the parent." So I
think you've skipped some important steps in your learning process.

I would go back to the beginning and work your way through Better
Builds With Maven (free pdf book from devzuz.com) and Maven: The
Definitive Guide (from sonatype.com). The books are organized such
that you start out learning how Maven works internally (generally),
and then they lead through some basic examples and finally take you
through much more involved examples.

You should be able to do this in just 1 or 2 days, and I think you
really need to invest this time now rather than attempting to hack
your poms and assemblies just to make it work.

Wayne

On 3/7/08, krishnan.1000 <kr...@gmail.com> wrote:
>
>  <build>
>    <plugins>
>       <plugin>
>        <artifactId>maven-compiler-plugin</artifactId>
>        <version>2.1-20080129.223043-7</version>
>        <configuration>
>          <source>1.5</source>
>          <target>1.5</target>
>        </configuration>
>      </plugin>
>      <!--  TestNg plugin -->
>     <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-surefire-plugin</artifactId>
>        <version>2.4</version>
>        <configuration>
>          <suiteXmlFiles>
>            <suiteXmlFile>testng.xml</suiteXmlFile>
>          </suiteXmlFiles>
>        </configuration>
>      </plugin>
>      <plugin>
>        <artifactId>maven-assembly-plugin</artifactId>
>        <configuration>
>          <descriptorRefs>
>            <descriptorRef>jar-with-dependencies</descriptorRef>
>          </descriptorRefs>
>          <archive>
>            <manifest>
>              <addClasspath>true</addClasspath>
>              <mainClass>com.jbe.core.Foo</mainClass>
>            </manifest>
>          </archive>
>        </configuration>
>      </plugin>
>    </plugins>
>  </build>
>
> <parent>
>    <relativePath>../pom.xml</relativePath>
>    <version>0.1</version>
>    <artifactId>foo-foo</artifactId>
>    <groupId>foo</groupId>
>  </parent>
>
> I also find that I have to include foo-b in my foo's pom.xml in order to
> compile even though, foo-a is dependent on foo-b and therefore must compile
> foo-b before foo-a.
> <dependencies>
>  <dependency>
>      <groupId>foo</groupId>
>      <artifactId>foo-a</artifactId>
>      <version>${project.version}</version>
>      <scope>compile</scope>
>    </dependency>
> <dependency>
>      <groupId>foo</groupId>
>      <artifactId>foo-b</artifactId>
>      <version>${project.version}</version>
>      <scope>compile</scope>
> </dependency>
> /dependencies>
>
> In addition, I have to add dependencies in all the pom.xml even if they have
> been specified in the parent pom.xml.
>
> Thanks,
>
> Karthik Krishnan
>
>
>
> krishnan.1000 wrote:
> >
> > Hi Wayne,
> >
> > I am sorry Wayne. I should have been more specific on the post. To answer
> > your first comment,  and I do not wish to sound rude, but if I knew what I
> > was doing wrong, I would not have posted in the first place.
> >
> > 2. I am trying to assemble a jar of module Foo and Bar . I wish that I
> > create an executable jar with a defined main class and a classpath added
> > to MANIFEST.MF. So basically i want the to create foo.jar and bar.jar
> > containing all the dependencies.
> >
> > 3. I find  that if i make the changes in Foo-A or FooB java classes, and
> > if i execute a mvn assembly:assembly, it does not build the FOO-A or FOO-B
> > in the .m2 repository before building Foo and Bar successfully again I
> > have to get around that by doing the following
> >
> > mvn install:install-file
> > -Dfile=/home/krishnan/project/foo-a/target/foo-a-0.1.jar -DgroupId=project
> > -DartifactId=foo-a -Dversion=0.1 -Dpackaging=jar -DgeneratePOM=true, the
> > solution I found by doing a search on one of the posts.
> >
> > and again for foo-b. I would like to avoid that and just have mvn
> > assembly:assembly do all this before creating foo.jar and bar.jar.
> >
> >
> >
> > Wayne Fay wrote:
> >>
> >> This list really works better if you post what you've done and then
> >> tell us why its not working the way you wanted, or an error message
> >> you got, etc. Looking at what you sent, I have no idea if it is
> >> working how you expect or not.
> >>
> >> Sending your pom and assembly.xml file is probably not going to give
> >> you the results you are hoping for. So, send a reply and be more clear
> >> about what you've got vs what you want etc.
> >>
> >> Wayne
> >>
> >> On 3/6/08, krishnan.1000 <kr...@gmail.com> wrote:
> >>>
> >>> Hi,
> >>>
> >>> I am a Maven newbie and I hope this is not a stupid question.  I am
> >>> trying
> >>> to create two Maven assembly jars for modules Foo and Bar. My project --
> >>>         |
> >>>         |------- Bar
> >>>         |------- Foo
> >>>         |--------Foo-A
> >>>         |------- Foo-B
> >>>
> >>>
> >>> This is my project structure. In this project, FOO-A is dependent on
> >>> Foo-B
> >>> and Bar ,Foo are dependent upon FOO-A. I am trying to build assembly
> >>> jars
> >>> for both the for both Foo and Bar modules. Can you please help me?
> >>>
> >>> My project pom is as follows.
> >>>
> >>> <modules>
> >>>    <module>Bar</module>
> >>>    <module>Foo</module>
> >>>    <module>Foo-A</module>
> >>>    <module>Foo-B</module>
> >>>  </modules>
> >>>
> >>>  <dependencies>
> >>>    <dependency>
> >>>      <groupId>log4j</groupId>
> >>>      <artifactId>log4j</artifactId>
> >>>      <version>1.2.13</version>
> >>>      <scope>compile</scope>
> >>>    </dependency>
> >>>
> >>>    ......
> >>>  </dependencies>
> >>>
> >>>  <build>
> >>>    <plugins>
> >>>      <plugin>
> >>>        <artifactId>maven-assembly-plugin</artifactId>
> >>>        <configuration>
> >>>          <descriptors>
> >>>            <descriptor>assembly.xml</descriptor>
> >>>          </descriptors>
> >>>          <tarLongFileMode>gnu</tarLongFileMode>
> >>>        </configuration>
> >>>      </plugin>
> >>>  </build>
> >>>
> >>>  <pluginRepositories>
> >>>    <pluginRepository>
> >>>      <id>apache.snapshots</id>
> >>>      <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
> >>>    </pluginRepository>
> >>>  </pluginRepositories>
> >>>
> >>> My assembly.xml
> >>>
> >>> <assembly>
> >>>  <id>jar-with-dependencies</id>
> >>>  <formats>
> >>>    <format>jar</format>
> >>>  </formats>
> >>>  <includeBaseDirectory>false</includeBaseDirectory>
> >>>  <fileSets>
> >>>    <fileSet>
> >>>      <directory>target/classes</directory>
> >>>      <outputDirectory>/</outputDirectory>
> >>>    </fileSet>
> >>>  </fileSets>
> >>>  <dependencySets>
> >>>    <dependencySet>
> >>>      <outputDirectory>/</outputDirectory>
> >>>      <unpack>false</unpack>
> >>>      <scope>runtime</scope>
> >>>    </dependencySet>
> >>>  </dependencySets>
> >>> </assembly>
> >>>
> >>>
> >>> --
> >>> View this message in context:
> >>> http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s177p15885942.html
> >>> Sent from the Maven - Users mailing list archive at Nabble.com.
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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
> >>
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s177p15890673.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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: Maven Assembly for MultiModule project

Posted by "krishnan.1000" <kr...@gmail.com>.
 <build>
    <plugins>
       <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.1-20080129.223043-7</version>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <!--  TestNg plugin -->
     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>testng.xml</suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
          <archive>
            <manifest>
              <addClasspath>true</addClasspath>
              <mainClass>com.jbe.core.Foo</mainClass>
            </manifest>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>

<parent>
    <relativePath>../pom.xml</relativePath>
    <version>0.1</version>
    <artifactId>foo-foo</artifactId>
    <groupId>foo</groupId>
  </parent>

I also find that I have to include foo-b in my foo's pom.xml in order to
compile even though, foo-a is dependent on foo-b and therefore must compile
foo-b before foo-a.
<dependencies>
 <dependency>
      <groupId>foo</groupId>
      <artifactId>foo-a</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
    </dependency> 
<dependency>
      <groupId>foo</groupId>
      <artifactId>foo-b</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
</dependency> 
/dependencies>

In addition, I have to add dependencies in all the pom.xml even if they have
been specified in the parent pom.xml. 

Thanks,

Karthik Krishnan



krishnan.1000 wrote:
> 
> Hi Wayne,
> 
> I am sorry Wayne. I should have been more specific on the post. To answer
> your first comment,  and I do not wish to sound rude, but if I knew what I
> was doing wrong, I would not have posted in the first place. 
> 
> 2. I am trying to assemble a jar of module Foo and Bar . I wish that I
> create an executable jar with a defined main class and a classpath added
> to MANIFEST.MF. So basically i want the to create foo.jar and bar.jar
> containing all the dependencies.
> 
> 3. I find  that if i make the changes in Foo-A or FooB java classes, and
> if i execute a mvn assembly:assembly, it does not build the FOO-A or FOO-B
> in the .m2 repository before building Foo and Bar successfully again I
> have to get around that by doing the following 
> 
> mvn install:install-file
> -Dfile=/home/krishnan/project/foo-a/target/foo-a-0.1.jar -DgroupId=project
> -DartifactId=foo-a -Dversion=0.1 -Dpackaging=jar -DgeneratePOM=true, the
> solution I found by doing a search on one of the posts.
> 
> and again for foo-b. I would like to avoid that and just have mvn
> assembly:assembly do all this before creating foo.jar and bar.jar.
> 
> 
> 
> Wayne Fay wrote:
>> 
>> This list really works better if you post what you've done and then
>> tell us why its not working the way you wanted, or an error message
>> you got, etc. Looking at what you sent, I have no idea if it is
>> working how you expect or not.
>> 
>> Sending your pom and assembly.xml file is probably not going to give
>> you the results you are hoping for. So, send a reply and be more clear
>> about what you've got vs what you want etc.
>> 
>> Wayne
>> 
>> On 3/6/08, krishnan.1000 <kr...@gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> I am a Maven newbie and I hope this is not a stupid question.  I am
>>> trying
>>> to create two Maven assembly jars for modules Foo and Bar. My project --
>>>         |
>>>         |------- Bar
>>>         |------- Foo
>>>         |--------Foo-A
>>>         |------- Foo-B
>>>
>>>
>>> This is my project structure. In this project, FOO-A is dependent on
>>> Foo-B
>>> and Bar ,Foo are dependent upon FOO-A. I am trying to build assembly
>>> jars
>>> for both the for both Foo and Bar modules. Can you please help me?
>>>
>>> My project pom is as follows.
>>>
>>> <modules>
>>>    <module>Bar</module>
>>>    <module>Foo</module>
>>>    <module>Foo-A</module>
>>>    <module>Foo-B</module>
>>>  </modules>
>>>
>>>  <dependencies>
>>>    <dependency>
>>>      <groupId>log4j</groupId>
>>>      <artifactId>log4j</artifactId>
>>>      <version>1.2.13</version>
>>>      <scope>compile</scope>
>>>    </dependency>
>>>
>>>    ......
>>>  </dependencies>
>>>
>>>  <build>
>>>    <plugins>
>>>      <plugin>
>>>        <artifactId>maven-assembly-plugin</artifactId>
>>>        <configuration>
>>>          <descriptors>
>>>            <descriptor>assembly.xml</descriptor>
>>>          </descriptors>
>>>          <tarLongFileMode>gnu</tarLongFileMode>
>>>        </configuration>
>>>      </plugin>
>>>  </build>
>>>
>>>  <pluginRepositories>
>>>    <pluginRepository>
>>>      <id>apache.snapshots</id>
>>>      <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
>>>    </pluginRepository>
>>>  </pluginRepositories>
>>>
>>> My assembly.xml
>>>
>>> <assembly>
>>>  <id>jar-with-dependencies</id>
>>>  <formats>
>>>    <format>jar</format>
>>>  </formats>
>>>  <includeBaseDirectory>false</includeBaseDirectory>
>>>  <fileSets>
>>>    <fileSet>
>>>      <directory>target/classes</directory>
>>>      <outputDirectory>/</outputDirectory>
>>>    </fileSet>
>>>  </fileSets>
>>>  <dependencySets>
>>>    <dependencySet>
>>>      <outputDirectory>/</outputDirectory>
>>>      <unpack>false</unpack>
>>>      <scope>runtime</scope>
>>>    </dependencySet>
>>>  </dependencySets>
>>> </assembly>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s177p15885942.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s177p15890673.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Maven Assembly for MultiModule project

Posted by "krishnan.1000" <kr...@gmail.com>.
Hi Wayne,

I am sorry Wayne. I should have been more specific on the post. To answer
your first comment,  and I do not wish to sound rude, but if I knew what I
was doing wrong, I would not have posted in the first place. 

2. I am trying to assemble a jar of module Foo and Bar . I wish that I
create an executable jar with a defined main class and a classpath added to
MANIFEST.MF. So basically i want the to create foo.jar and bar.jar
containing all the dependencies.

3. I find  that if i make the changes in Foo-A or FooB java classes, and if
i execute a mvn assembly:assembly, it does not build the FOO-A or FOO-B in
the .m2 repository before building Foo and Bar successfully again I have to
get around that by doing the following 

mvn install:install-file
-Dfile=/home/krishnan/project/foo-a/target/foo-a-0.1.jar -DgroupId=project
-DartifactId=foo-a -Dversion=0.1 -Dpackaging=jar -DgeneratePOM=true, the
solution I found by doing a search on one of the posts.

and again for foo-b. I would like to avoid that and just have mvn
assembly:assembly do all this before creating foo.jar and bar.jar.



Wayne Fay wrote:
> 
> This list really works better if you post what you've done and then
> tell us why its not working the way you wanted, or an error message
> you got, etc. Looking at what you sent, I have no idea if it is
> working how you expect or not.
> 
> Sending your pom and assembly.xml file is probably not going to give
> you the results you are hoping for. So, send a reply and be more clear
> about what you've got vs what you want etc.
> 
> Wayne
> 
> On 3/6/08, krishnan.1000 <kr...@gmail.com> wrote:
>>
>> Hi,
>>
>> I am a Maven newbie and I hope this is not a stupid question.  I am
>> trying
>> to create two Maven assembly jars for modules Foo and Bar. My project --
>>         |
>>         |------- Bar
>>         |------- Foo
>>         |--------Foo-A
>>         |------- Foo-B
>>
>>
>> This is my project structure. In this project, FOO-A is dependent on
>> Foo-B
>> and Bar ,Foo are dependent upon FOO-A. I am trying to build assembly jars
>> for both the for both Foo and Bar modules. Can you please help me?
>>
>> My project pom is as follows.
>>
>> <modules>
>>    <module>Bar</module>
>>    <module>Foo</module>
>>    <module>Foo-A</module>
>>    <module>Foo-B</module>
>>  </modules>
>>
>>  <dependencies>
>>    <dependency>
>>      <groupId>log4j</groupId>
>>      <artifactId>log4j</artifactId>
>>      <version>1.2.13</version>
>>      <scope>compile</scope>
>>    </dependency>
>>
>>    ......
>>  </dependencies>
>>
>>  <build>
>>    <plugins>
>>      <plugin>
>>        <artifactId>maven-assembly-plugin</artifactId>
>>        <configuration>
>>          <descriptors>
>>            <descriptor>assembly.xml</descriptor>
>>          </descriptors>
>>          <tarLongFileMode>gnu</tarLongFileMode>
>>        </configuration>
>>      </plugin>
>>  </build>
>>
>>  <pluginRepositories>
>>    <pluginRepository>
>>      <id>apache.snapshots</id>
>>      <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
>>    </pluginRepository>
>>  </pluginRepositories>
>>
>> My assembly.xml
>>
>> <assembly>
>>  <id>jar-with-dependencies</id>
>>  <formats>
>>    <format>jar</format>
>>  </formats>
>>  <includeBaseDirectory>false</includeBaseDirectory>
>>  <fileSets>
>>    <fileSet>
>>      <directory>target/classes</directory>
>>      <outputDirectory>/</outputDirectory>
>>    </fileSet>
>>  </fileSets>
>>  <dependencySets>
>>    <dependencySet>
>>      <outputDirectory>/</outputDirectory>
>>      <unpack>false</unpack>
>>      <scope>runtime</scope>
>>    </dependencySet>
>>  </dependencySets>
>> </assembly>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s177p15885942.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s177p15890574.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Maven Assembly for MultiModule project

Posted by Wayne Fay <wa...@gmail.com>.
This list really works better if you post what you've done and then
tell us why its not working the way you wanted, or an error message
you got, etc. Looking at what you sent, I have no idea if it is
working how you expect or not.

Sending your pom and assembly.xml file is probably not going to give
you the results you are hoping for. So, send a reply and be more clear
about what you've got vs what you want etc.

Wayne

On 3/6/08, krishnan.1000 <kr...@gmail.com> wrote:
>
> Hi,
>
> I am a Maven newbie and I hope this is not a stupid question.  I am trying
> to create two Maven assembly jars for modules Foo and Bar. My project --
>         |
>         |------- Bar
>         |------- Foo
>         |--------Foo-A
>         |------- Foo-B
>
>
> This is my project structure. In this project, FOO-A is dependent on Foo-B
> and Bar ,Foo are dependent upon FOO-A. I am trying to build assembly jars
> for both the for both Foo and Bar modules. Can you please help me?
>
> My project pom is as follows.
>
> <modules>
>    <module>Bar</module>
>    <module>Foo</module>
>    <module>Foo-A</module>
>    <module>Foo-B</module>
>  </modules>
>
>  <dependencies>
>    <dependency>
>      <groupId>log4j</groupId>
>      <artifactId>log4j</artifactId>
>      <version>1.2.13</version>
>      <scope>compile</scope>
>    </dependency>
>
>    ......
>  </dependencies>
>
>  <build>
>    <plugins>
>      <plugin>
>        <artifactId>maven-assembly-plugin</artifactId>
>        <configuration>
>          <descriptors>
>            <descriptor>assembly.xml</descriptor>
>          </descriptors>
>          <tarLongFileMode>gnu</tarLongFileMode>
>        </configuration>
>      </plugin>
>  </build>
>
>  <pluginRepositories>
>    <pluginRepository>
>      <id>apache.snapshots</id>
>      <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
>    </pluginRepository>
>  </pluginRepositories>
>
> My assembly.xml
>
> <assembly>
>  <id>jar-with-dependencies</id>
>  <formats>
>    <format>jar</format>
>  </formats>
>  <includeBaseDirectory>false</includeBaseDirectory>
>  <fileSets>
>    <fileSet>
>      <directory>target/classes</directory>
>      <outputDirectory>/</outputDirectory>
>    </fileSet>
>  </fileSets>
>  <dependencySets>
>    <dependencySet>
>      <outputDirectory>/</outputDirectory>
>      <unpack>false</unpack>
>      <scope>runtime</scope>
>    </dependencySet>
>  </dependencySets>
> </assembly>
>
>
> --
> View this message in context: http://www.nabble.com/Maven-Assembly-for-MultiModule-project-tp15885942s177p15885942.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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