You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by zebahmad <co...@gmail.com> on 2011/11/17 04:53:45 UTC

Building multi-module project with cross-references

Hi,

I am currently migrating my projects from my company's in-house build system
based on ant, to maven. We have a concept of deliverable, where a
deliverable may be a combination of projects. Two or more projects are
basically merged, to create a deliverable. The projects may be part of more
than 1 deliverable. 

e.g. Suppose we have 4 projects
ProjectA
ProjectB
ProjectC
ProjectD
and two deliverables
DeliverableX |--*ProjectA*
                 |--ProjectB
DeliverableY|--*ProjectA*
                |--ProjectC
                |--ProjectD

Here ProjectA needs to be separated out as it is common code, yet it is part
of the DeliverableX and DeliverableY. I cannot change the structure of
DeliverableX and DeliverableY, as the existing codebase entirely depends
upon this packaging. How can I implement this with maven? I checked out
multi-module projects, but that seems to require me to embed the module into
a parent project. Any pointers are appreciated!!

Thanks in advance
Zeba

--
View this message in context: http://maven.40175.n5.nabble.com/Building-multi-module-project-with-cross-references-tp4999937p4999937.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 multi-module project with cross-references

Posted by Ron Wheeler <rw...@artifact-software.com>.
The assembly plug-in is your friend!

If you want to assemble an archive of sources, you will have to find a 
way to check out the sources from your version control system.
I have never had to do this but I am sure that there is a plug-in 
somewhere if you are using a standard source control system.
In the worst case, you can use Ant to do this. Maven has an Ant plug-in 
to allow you to execute an Ant project.

After that, the assembly plug-in should be able to build you an archive 
that includes the sources.

Ron

On 17/11/2011 12:26 AM, zebahmad wrote:
> Thanks for the info&  advice, Ron..Will keep in mind! Btw, using all of them
> as projects will not ensure the artifact structure to be maintained for
> deliverables - I need the deliverable to have the source contents of the
> other projects to be brought in ..
>
> Thanks,
> Zeba
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Building-multi-module-project-with-cross-references-tp4999937p5000099.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 multi-module project with cross-references

Posted by zebahmad <co...@gmail.com>.
Thanks for the info & advice, Ron..Will keep in mind! Btw, using all of them
as projects will not ensure the artifact structure to be maintained for
deliverables - I need the deliverable to have the source contents of the
other projects to be brought in ..

Thanks,
Zeba

--
View this message in context: http://maven.40175.n5.nabble.com/Building-multi-module-project-with-cross-references-tp4999937p5000099.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 multi-module project with cross-references

Posted by Ron Wheeler <rw...@artifact-software.com>.
We are a small team but have a couple of big Maven projects.
One project has over 70 modules that depends on about 60 external libraries.
The final application is a portal that runs on Tomcat.

Ron


On 16/11/2011 11:57 PM, Ron Wheeler wrote:
> Your situation is pretty common.
>
> ProjectA
> ProjectB
> ProjectC
> ProjectD
> DeliverableX
> DeliverableY
> are all separate projects.
> You build and release Project A to D as independent library versions.
> The deliverables are just projects that depend on the other projects. 
> Think of your projects in the same way you look at third party libraries
>
> Do not get too confused about parent projects. Try to keep them simple 
> and focused on identifying things that are common to the entire 
> project(deployment repositories).
>
> Get your own Maven repo installed and working before you start using 
> Mavem. I really like Nexus but some people use other repo systems.
> It makes the whole Maven concept easier to understand and puts you on 
> the right track .
> We wasted 2 years working with Maven without a repo.
>
> Key things to remember:
> 1) Maven profiles are inherently evil.  They leads to problems and 
> really bad practices. In my opinion, the world would be a better place 
> without them. I have never used them but I have seen people get into 
> bad headspaces after dabbling in profiles.
> 2) If you fight Maven you will lose. It is very determined and depends 
> on you adopting the "Maven philosophy". It will battle you until you 
> submit so you might as well submit now and enjoy life.
> 3) Do not mix run-time issues with build time activities. 
> http://blog.artifact-software.com/tech/?p=58
> 4) Use the assembly plug-in to build modules that create archives 
> (zip, war) that do not have any compiled code (DeliverableX, 
> DeliverableY). The shade plug-in is also used. Not sure why.
> 5) Remember that thousands of people use maven to build all sorts of 
> applications. If you have questions - ask. Someone has already solved 
> the problem unless you are building something so bizarre that no one 
> else has ever built anything like it.
>
>
> Ron
>
>
> On 16/11/2011 11:34 PM, Barrie Treloar wrote:
>> On Thu, Nov 17, 2011 at 2:23 PM, zebahmad<co...@gmail.com>  wrote:
>>> Hi,
>>>
>>> I am currently migrating my projects from my company's in-house 
>>> build system
>>> based on ant, to maven. We have a concept of deliverable, where a
>>> deliverable may be a combination of projects. Two or more projects are
>>> basically merged, to create a deliverable. The projects may be part 
>>> of more
>>> than 1 deliverable.
>>>
>>> e.g. Suppose we have 4 projects
>>> ProjectA
>>> ProjectB
>>> ProjectC
>>> ProjectD
>>> and two deliverables
>>> DeliverableX |--*ProjectA*
>>>                  |--ProjectB
>>> DeliverableY|--*ProjectA*
>>>                 |--ProjectC
>>>                 |--ProjectD
>>>
>>> Here ProjectA needs to be separated out as it is common code, yet it 
>>> is part
>>> of the DeliverableX and DeliverableY. I cannot change the structure of
>>> DeliverableX and DeliverableY, as the existing codebase entirely 
>>> depends
>>> upon this packaging. How can I implement this with maven? I checked out
>>> multi-module projects, but that seems to require me to embed the 
>>> module into
>>> a parent project. Any pointers are appreciated!!
>> Have you read the freely available books at
>> http://maven.apache.org/articles.html
>>
>> You can try the assembly plugin
>> http://maven.apache.org/plugins/maven-assembly-plugin/
>> That should be able to copy/layout on disk the contents of the
>> artifacts for each project that DeliverableX depends upon allowing you
>> to repackage however you see fit.
>>
>> ---------------------------------------------------------------------
>> 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


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


Re: Building multi-module project with cross-references

Posted by Ron Wheeler <rw...@artifact-software.com>.
Your situation is pretty common.

ProjectA
ProjectB
ProjectC
ProjectD
DeliverableX
DeliverableY
are all separate projects.
You build and release Project A to D as independent library versions.
The deliverables are just projects that depend on the other projects. Think of your projects in the same way you look at third party libraries

Do not get too confused about parent projects. Try to keep them simple 
and focused on identifying things that are common to the entire 
project(deployment repositories).

Get your own Maven repo installed and working before you start using 
Mavem. I really like Nexus but some people use other repo systems.
It makes the whole Maven concept easier to understand and puts you on 
the right track .
We wasted 2 years working with Maven without a repo.

Key things to remember:
1) Maven profiles are inherently evil.  They leads to problems and 
really bad practices. In my opinion, the world would be a better place 
without them. I have never used them but I have seen people get into bad 
headspaces after dabbling in profiles.
2) If you fight Maven you will lose. It is very determined and depends 
on you adopting the "Maven philosophy". It will battle you until you 
submit so you might as well submit now and enjoy life.
3) Do not mix run-time issues with build time activities. 
http://blog.artifact-software.com/tech/?p=58
4) Use the assembly plug-in to build modules that create archives (zip, 
war) that do not have any compiled code (DeliverableX, DeliverableY). 
The shade plug-in is also used. Not sure why.
5) Remember that thousands of people use maven to build all sorts of 
applications. If you have questions - ask. Someone has already solved 
the problem unless you are building something so bizarre that no one 
else has ever built anything like it.


Ron


On 16/11/2011 11:34 PM, Barrie Treloar wrote:
> On Thu, Nov 17, 2011 at 2:23 PM, zebahmad<co...@gmail.com>  wrote:
>> Hi,
>>
>> I am currently migrating my projects from my company's in-house build system
>> based on ant, to maven. We have a concept of deliverable, where a
>> deliverable may be a combination of projects. Two or more projects are
>> basically merged, to create a deliverable. The projects may be part of more
>> than 1 deliverable.
>>
>> e.g. Suppose we have 4 projects
>> ProjectA
>> ProjectB
>> ProjectC
>> ProjectD
>> and two deliverables
>> DeliverableX |--*ProjectA*
>>                  |--ProjectB
>> DeliverableY|--*ProjectA*
>>                 |--ProjectC
>>                 |--ProjectD
>>
>> Here ProjectA needs to be separated out as it is common code, yet it is part
>> of the DeliverableX and DeliverableY. I cannot change the structure of
>> DeliverableX and DeliverableY, as the existing codebase entirely depends
>> upon this packaging. How can I implement this with maven? I checked out
>> multi-module projects, but that seems to require me to embed the module into
>> a parent project. Any pointers are appreciated!!
> Have you read the freely available books at
> http://maven.apache.org/articles.html
>
> You can try the assembly plugin
> http://maven.apache.org/plugins/maven-assembly-plugin/
> That should be able to copy/layout on disk the contents of the
> artifacts for each project that DeliverableX depends upon allowing you
> to repackage however you see fit.
>
> ---------------------------------------------------------------------
> 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 multi-module project with cross-references

Posted by zebahmad <co...@gmail.com>.
Thanks much for the pointer, Barrie! The assembly plugin looks to be exactly
what I needed!

Zeba

--
View this message in context: http://maven.40175.n5.nabble.com/Building-multi-module-project-with-cross-references-tp4999937p5000096.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 multi-module project with cross-references

Posted by Barrie Treloar <ba...@gmail.com>.
On Thu, Nov 17, 2011 at 2:23 PM, zebahmad <co...@gmail.com> wrote:
> Hi,
>
> I am currently migrating my projects from my company's in-house build system
> based on ant, to maven. We have a concept of deliverable, where a
> deliverable may be a combination of projects. Two or more projects are
> basically merged, to create a deliverable. The projects may be part of more
> than 1 deliverable.
>
> e.g. Suppose we have 4 projects
> ProjectA
> ProjectB
> ProjectC
> ProjectD
> and two deliverables
> DeliverableX |--*ProjectA*
>                 |--ProjectB
> DeliverableY|--*ProjectA*
>                |--ProjectC
>                |--ProjectD
>
> Here ProjectA needs to be separated out as it is common code, yet it is part
> of the DeliverableX and DeliverableY. I cannot change the structure of
> DeliverableX and DeliverableY, as the existing codebase entirely depends
> upon this packaging. How can I implement this with maven? I checked out
> multi-module projects, but that seems to require me to embed the module into
> a parent project. Any pointers are appreciated!!

Have you read the freely available books at
http://maven.apache.org/articles.html

You can try the assembly plugin
http://maven.apache.org/plugins/maven-assembly-plugin/
That should be able to copy/layout on disk the contents of the
artifacts for each project that DeliverableX depends upon allowing you
to repackage however you see fit.

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