Discussion:
Multi-module passing properties to children
Jared Blitzstein
2007-05-02 20:35:53 UTC
Permalink
I have 5 projects that I want to build as a suite. I created a multi-
module to do this and it's fine out of the box for just calling the
sub projects. But I need to be able to set variables in the multi-
module to pass in like the version, profile, and some other basic
things. But I also need to make sure each of these projects can live
on their own. I've read http://www.sonatype.com/book/pom-
relationships.html as well as the getting-started on mavens website
but they don't speak to what I'm trying to do. Can anyone point me in
the right direction?
Wayne Fay
2007-05-02 21:17:36 UTC
Permalink
Put the shared properties in profiles in the parent pom, include the
children as <modules/> in the parent pom, and use the parent tag in
the children to share properties with all your poms.

Or is there a specific reason this is not sufficient?

Wayne
Post by Jared Blitzstein
I have 5 projects that I want to build as a suite. I created a multi-
module to do this and it's fine out of the box for just calling the
sub projects. But I need to be able to set variables in the multi-
module to pass in like the version, profile, and some other basic
things. But I also need to make sure each of these projects can live
on their own. I've read http://www.sonatype.com/book/pom-
relationships.html as well as the getting-started on mavens website
but they don't speak to what I'm trying to do. Can anyone point me in
the right direction?
---------------------------------------------------------------------
Jared Blitzstein
2007-05-02 23:04:00 UTC
Permalink
Does using the parent tag require the project to be in a repository?
I planned on having this "suitepom" accessible via CVS but not
something that is going to be installed in our company repo. I may be
way off base though.

Also, how would you pass something through like a version? The
version tag is required in the child pom so you can't leave it out,
and if I do ${version} it doesn't pick that up from the definition in
the master pom, it just uses "${version}" literally.
Post by Wayne Fay
Put the shared properties in profiles in the parent pom, include the
children as <modules/> in the parent pom, and use the parent tag in
the children to share properties with all your poms.
Or is there a specific reason this is not sufficient?
Wayne
Post by Jared Blitzstein
I have 5 projects that I want to build as a suite. I created a multi-
module to do this and it's fine out of the box for just calling the
sub projects. But I need to be able to set variables in the multi-
module to pass in like the version, profile, and some other basic
things. But I also need to make sure each of these projects can live
on their own. I've read http://www.sonatype.com/book/pom-
relationships.html as well as the getting-started on mavens website
but they don't speak to what I'm trying to do. Can anyone point me in
the right direction?
---------------------------------------------------------------------
---------------------------------------------------------------------
Balasubramanian, Ravi Shankar
2007-05-03 04:30:36 UTC
Permalink
Hi,
The master pom in this case need not be installed in the repository. You
can use the relativePath element under the parent tag to point to your
master pom. Something like as follows:
<parent>
<groupId>...</groupId>
<artifactId>..</artifactId>
<relativePath>../(CORRECT_RELATIVE_PATH_TO_WHERE_YOUR_MASTER_POM_EXISTS<
/relativePath>
</parent>

This does not require that your parent pom be installed in the
repository.



-----Original Message-----
From: Jared Blitzstein [mailto:mailing-***@blitzstein.net]
Sent: Thursday, May 03, 2007 4:34 AM
To: Maven Users List
Subject: Re: Multi-module passing properties to children

Does using the parent tag require the project to be in a repository?
I planned on having this "suitepom" accessible via CVS but not
something that is going to be installed in our company repo. I may be
way off base though.

Also, how would you pass something through like a version? The
version tag is required in the child pom so you can't leave it out,
and if I do ${version} it doesn't pick that up from the definition in
the master pom, it just uses "${version}" literally.
Post by Wayne Fay
Put the shared properties in profiles in the parent pom, include the
children as <modules/> in the parent pom, and use the parent tag in
the children to share properties with all your poms.
Or is there a specific reason this is not sufficient?
Wayne
Post by Jared Blitzstein
I have 5 projects that I want to build as a suite. I created a multi-
module to do this and it's fine out of the box for just calling the
sub projects. But I need to be able to set variables in the multi-
module to pass in like the version, profile, and some other basic
things. But I also need to make sure each of these projects can live
on their own. I've read http://www.sonatype.com/book/pom-
relationships.html as well as the getting-started on mavens website
but they don't speak to what I'm trying to do. Can anyone point me in
the right direction?
---------------------------------------------------------------------
---------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: users-***@maven.apache.org
For additional commands, e-mail: users-***@maven.apache.org
Roland Asmann
2007-05-03 08:59:58 UTC
Permalink
If you include a <parent>-tag for your parent-POM, your project automatically
inherits its version (unless you set it manually).
In case you need to reference it in other places as well, try using
${parent.version}
Post by Jared Blitzstein
Does using the parent tag require the project to be in a repository?
I planned on having this "suitepom" accessible via CVS but not
something that is going to be installed in our company repo. I may be
way off base though.
Also, how would you pass something through like a version? The
version tag is required in the child pom so you can't leave it out,
and if I do ${version} it doesn't pick that up from the definition in
the master pom, it just uses "${version}" literally.
--
Roland Asmann

CFC Informationssysteme Entwicklungsgesellschaft m.b.H
Bäckerstrasse 1/2/7
A-1010 Wien
FN 266155f, Handelsgericht Wien

Tel.: +43/1/513 88 77 - 27
Fax.: +43/1/513 88 62
Email: ***@cfc.at
Web: www.cfc.at
wayneaz
2008-03-27 04:57:53 UTC
Permalink
Wayne, your answer sounds like it might solve my problem, but I am a new user
and am not sure of the syntax to implement your suggestion.

I am creating a buildnumber with a time stamp in the parent pom using the
buildnumber plugin. I want to pass the resultant property, ${buildNumber},
to all the children to include in their manifests. I have tried several
things, but have found no way to reference this property in the children
poms.

I have been through hundreds of postings and googled other items and this
question seems to come up a lot, but no one ever responds or their response
is too criptic for a novice to implement.

Your help would be appreciated.

Thanks
Wayne
Post by Wayne Fay
Put the shared properties in profiles in the parent pom, include the
children as <modules/> in the parent pom, and use the parent tag in
the children to share properties with all your poms.
Or is there a specific reason this is not sufficient?
Wayne
Post by Jared Blitzstein
I have 5 projects that I want to build as a suite. I created a multi-
module to do this and it's fine out of the box for just calling the
sub projects. But I need to be able to set variables in the multi-
module to pass in like the version, profile, and some other basic
things. But I also need to make sure each of these projects can live
on their own. I've read http://www.sonatype.com/book/pom-
relationships.html as well as the getting-started on mavens website
but they don't speak to what I'm trying to do. Can anyone point me in
the right direction?
---------------------------------------------------------------------
---------------------------------------------------------------------
--
View this message in context: http://www.nabble.com/Multi-module-passing-properties-to-children-tp10294239s177p16321438.html
Sent from the Maven - Users mailing list archive at Nabble.com.
Loading...