You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Amit Bhargava <am...@gmail.com> on 2011/12/12 17:28:00 UTC

Building 2 dependent modules

Hi folks,

I'm a bit new to Maven. I have some existing modules. One of them is a
'common' module which has utilities used by the other modules. how do I set
up a build to package all the modules together? I tried finding a way to add
the 'common' jar to the local repository immediately after creating it but
no luck. Thanks for all your help 

--
View this message in context: http://maven.40175.n5.nabble.com/Building-2-dependent-modules-tp5068822p5068822.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: Building 2 dependent modules

Posted by Barrie Treloar <ba...@gmail.com>.
On Tue, Dec 13, 2011 at 11:55 AM, Amit Bhargava <am...@gmail.com> wrote:
> Thanks Ron. It worked.
>
> Another question, if I may :
>
> In my pom, I had already specified the local repository using the
> <repositories> tag as follows
>
>         <repositories>
>                <repository>
>                  <id>local1</id>
>                  <name>My First Repository</name>
>                  <url>file://d:/apache-maven-3.0.3/repository</url>
>                  <layout>default</layout>
>                </repository>
>        </repositories>
>
> However, in distribution management, I had to give the details for the same
> repository as follows
>
>         <distributionManagement>
>                <repository>
>                        <id>local1</id>
>                        <name>My First Repository</name>
>                        <url>file://d:/apache-maven-3.0.3/repository</url>
>                </repository>
>        </distributionManagement>
>
> Seems to be a bit of a redundancy. Is there any way to avoid this?

Dont specify stuff in repositories>repository.
If this is stuff to be consumed by others then they also need access
to your repository.

Instead in your ~/.m2/settings.xml you will configure a mirror for
everything and point it to your locally accessible repository manager.
Then you get the admin of the repository manager to configure it to
know about any repositories you need. (e.g. Central, your local repo
for snapshots and releases, third party non-free binaries, etc)

I can highly recommend you read one of the freely available books (see
http://maven.apache.org/articles.html)

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


Re: Building 2 dependent modules

Posted by Amit Bhargava <am...@gmail.com>.
Thanks again folks. Much appreciated! I'll probably specify this in my parent
pom then

--
View this message in context: http://maven.40175.n5.nabble.com/Building-2-dependent-modules-tp5068822p5074678.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: Building 2 dependent modules

Posted by Ron Wheeler <rw...@artifact-software.com>.
Remember that there are 2 repositories involved.
1) where you look up things that you need
2) where you store the things that your project makes.

They may be the same but from Maven's point of view they are two 
different concepts.

You usually specify 1) globally in your settings file and 2) in the 
parent POM for the project.

Ron
On 12/12/2011 8:25 PM, Amit Bhargava wrote:
> Thanks Ron. It worked.
>
> Another question, if I may :
>
> In my pom, I had already specified the local repository using the
> <repositories>  tag as follows
>
>           <repositories>
> 		<repository>
> 		<id>local1</id>
> 		<name>My First Repository</name>
> 		<url>file://d:/apache-maven-3.0.3/repository</url>
> 		<layout>default</layout>
> 		</repository>
> 	</repositories>
>
> However, in distribution management, I had to give the details for the same
> repository as follows
>
>           <distributionManagement>
> 		<repository>
> 			<id>local1</id>
> 			<name>My First Repository</name>
> 			<url>file://d:/apache-maven-3.0.3/repository</url>
> 		</repository>
> 	</distributionManagement>
>
> Seems to be a bit of a redundancy. Is there any way to avoid this?
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Building-2-dependent-modules-tp5068822p5070035.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
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102



Re: Building 2 dependent modules

Posted by Amit Bhargava <am...@gmail.com>.
Thanks Ron. It worked.

Another question, if I may :

In my pom, I had already specified the local repository using the
<repositories> tag as follows
         
         <repositories>
		<repository>
		  <id>local1</id>
		  <name>My First Repository</name>
		  <url>file://d:/apache-maven-3.0.3/repository</url>
		  <layout>default</layout>
		</repository>
	</repositories>

However, in distribution management, I had to give the details for the same
repository as follows
        
         <distributionManagement>
		<repository>
			<id>local1</id>
			<name>My First Repository</name>
			<url>file://d:/apache-maven-3.0.3/repository</url>
		</repository>
	</distributionManagement>

Seems to be a bit of a redundancy. Is there any way to avoid this?

--
View this message in context: http://maven.40175.n5.nabble.com/Building-2-dependent-modules-tp5068822p5070035.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: Building 2 dependent modules

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 12/12/2011 11:28 AM, Amit Bhargava wrote:
> Hi folks,
>
> I'm a bit new to Maven. I have some existing modules. One of them is a
> 'common' module which has utilities used by the other modules. how do I set
> up a build to package all the modules together? I tried finding a way to add
> the 'common' jar to the local repository immediately after creating it but
> no luck. Thanks for all your help
Common module is a project by itself which you build and package in a 
jar with a GAV and publish to your repo (Nexus or other) with "deploy".
In the other modules, you reference common as a dependency using its GAV 
as the identifier.
Maven will do the rest.

You can also use a local repo as a start with "install" but you want to 
get a real repo as soon as you can.

Ron

>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Building-2-dependent-modules-tp5068822p5068822.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
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102