I have applied this patch to my local copy of maven to allow the correct
inheritance rules for properties supplied by the parent project to flow
to the child during a reactor build, instead of overwriting them with
the defaults from driver.properties. This allows me to specify things
like 'maven.username' at the parent project.properties level, and it
will propagate to the children for use in jar:deploy. Previously, when
reactor spawned the child context, it would impose the default value of
USERNAME_NOT_SET to 'maven.username' thus making it impossible to take
advantage of the hierarchical nature of a reactor build for common
property values. This patch corrects that problem by adding another
file: 'defaults.properties' which is loaded AFTER inheritance is turned
back on, so as to avoid overwriting values specified at the parent
project level. MavenUtils.java and MavenConstants.java, along with
driver.properties and project.xml have been adjusted to accommodate this
change. Defaults.properties lives in src/conf, just like
'driver.properties.'
Enjoy
--
John Casey <[EMAIL PROTECTED]>
? src/conf/defaults.properties
? src/plugins-build/castor/maven.xml
Index: project.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/project.xml,v
retrieving revision 1.254
diff -w -c -r1.254 project.xml
*** project.xml 26 Feb 2003 10:17:43 -0000 1.254
--- project.xml 26 Feb 2003 23:32:47 -0000
***************
*** 201,207 ****
</roles>
</developer>
<developer>
! <name>Stéphane Mor</name>
<id>smor</id>
<email>[EMAIL PROTECTED]</email>
<organization></organization>
--- 201,207 ----
</roles>
</developer>
<developer>
! <name>St�phane Mor</name>
<id>smor</id>
<email>[EMAIL PROTECTED]</email>
<organization></organization>
***************
*** 489,494 ****
--- 489,495 ----
<include>*.mod</include>
<include>log4j.properties</include>
<include>driver.jelly</include>
+ <include>defaults.properties</include>
<include>driver.properties</include>
</includes>
</resource>
Index: src/conf/driver.properties
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/src/conf/driver.properties,v
retrieving revision 1.5
diff -w -c -r1.5 driver.properties
*** src/conf/driver.properties 13 Jan 2003 18:49:57 -0000 1.5
--- src/conf/driver.properties 26 Feb 2003 23:32:47 -0000
***************
*** 1,60 ****
- # -------------------------------------------------------------------
- # D R I V E R P R O P E R T I E S
- # -------------------------------------------------------------------
-
- maven.src.dir = ${basedir}/src
- maven.conf.dir = ${basedir}/conf
- maven.build.dir = ${basedir}/target
- maven.build.src = ${maven.build.dir}/src
- maven.build.dest = ${maven.build.dir}/classes
-
- maven.compile.debug = on
- maven.compile.optimize = off
- maven.compile.deprecation = off
-
- maven.jar.excludes = **/package.html
-
maven.final.name = ${pom.artifactId}-${pom.currentVersion}
maven.final.dir = ${basedir}/${maven.final.name}
# -------------------------------------------------------------------
- # M A V E N L O C A L R E P O
- # -------------------------------------------------------------------
-
- maven.repo.local = ${maven.home}/repository
-
- # -------------------------------------------------------------------
- # M A V E N P L U G - I N D I R E C T O R Y
- # -------------------------------------------------------------------
-
- maven.plugin.dir = ${maven.home}/plugins
-
- # -------------------------------------------------------------------
- # M A V E N R E M O T E R E P O S
- # -------------------------------------------------------------------
-
- maven.repo.remote = http://www.ibiblio.org/maven
- maven.repo.central = login.ibiblio.org
- maven.repo.central.directory = /public/html/maven
- maven.repo.remote.enabled = true
-
- # -------------------------------------------------------------------
- # M A V E N D I S T R I B U T I O N S
- # -------------------------------------------------------------------
- maven.distBuildDirectory = ${basedir}/target
- maven.distBuildIndicator = DIST_BUILD_DIRECTORY
- maven.distDirectory = ${basedir}/dist
-
- # -------------------------------------------------------------------
- # E N V I R O N M E N T D E P E N D E N T T O O L S
- # -------------------------------------------------------------------
- maven.scp.executable = scp
- maven.ssh.executable = ssh
-
- # -------------------------------------------------------------------
# Mark the defaults as loaded - PLEASE DON'T OVERRIDE
# -------------------------------------------------------------------
maven.defaults.loaded = true
-
- maven.build = MAVEN_BUILD_NOT_SET
- maven.username=USERNAME_NOT_SET
--- 1,7 ----
Index: src/java/org/apache/maven/MavenConstants.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-maven/src/java/org/apache/maven/MavenConstants.java,v
retrieving revision 1.22
diff -w -c -r1.22 MavenConstants.java
*** src/java/org/apache/maven/MavenConstants.java 8 Jan 2003 20:25:57 -0000
1.22
--- src/java/org/apache/maven/MavenConstants.java 26 Feb 2003 23:32:47 -0000
***************
*** 120,125 ****
--- 120,128 ----
/** Driver properties */
public static final String DRIVER_PROPERTIES = "driver.properties";
+ /** Defaults properties */
+ public static final String DEFAULTS_PROPERTIES = "defaults.properties";
+
// Context tags.
/** MavenSession home context tag **/
Index: src/java/org/apache/maven/MavenUtils.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-maven/src/java/org/apache/maven/MavenUtils.java,v
retrieving revision 1.89
diff -w -c -r1.89 MavenUtils.java
*** src/java/org/apache/maven/MavenUtils.java 21 Feb 2003 07:03:33 -0000 1.89
--- src/java/org/apache/maven/MavenUtils.java 26 Feb 2003 23:32:48 -0000
***************
*** 781,786 ****
--- 781,790 ----
MavenUtils.class.getClassLoader().getResourceAsStream(
MavenConstants.DRIVER_PROPERTIES ) );
+ Properties defaultProperties = loadProperties(
+ MavenUtils.class.getClassLoader().getResourceAsStream(
+ MavenConstants.DEFAULTS_PROPERTIES ) );
+
Map result = MavenUtils.mergeMaps( new Map[]
{
systemProperties,
***************
*** 802,817 ****
{
context = new MavenJellyContext( parentContext );
context.setInherit( false );
}
else
{
context = new MavenJellyContext();
- }
MavenUtils.integrateMapInContext( result, context );
// Turn inheritance back on to make the parent's values visible.
context.setInherit( true );
// Set the basedir value in the context.
context.setVariable( "basedir", descriptorDirectory.getPath() );
--- 806,834 ----
{
context = new MavenJellyContext( parentContext );
context.setInherit( false );
+
+ MavenUtils.integrateMapInContext( result, context );
+
+ // Turn inheritance back on to make the parent's values visible.
+ context.setInherit( true );
+
+ //add in the driver.properties with defaults, but in inheritance mode.
+ MavenUtils.integrateMapInContext( defaultProperties, context );
}
else
{
context = new MavenJellyContext();
+ //integrate everything else...
MavenUtils.integrateMapInContext( result, context );
+ //integrate defaults...
+ MavenUtils.integrateMapInContext( defaultProperties, context );
+
// Turn inheritance back on to make the parent's values visible.
context.setInherit( true );
+ }
+
// Set the basedir value in the context.
context.setVariable( "basedir", descriptorDirectory.getPath() );
# -------------------------------------------------------------------
# D R I V E R P R O P E R T I E S
# -------------------------------------------------------------------
maven.src.dir = ${basedir}/src
maven.conf.dir = ${basedir}/conf
maven.build.dir = ${basedir}/target
maven.build.src = ${maven.build.dir}/src
maven.build.dest = ${maven.build.dir}/classes
maven.compile.debug = on
maven.compile.optimize = off
maven.compile.deprecation = off
maven.jar.excludes = **/package.html
# -------------------------------------------------------------------
# M A V E N L O C A L R E P O
# -------------------------------------------------------------------
maven.repo.local = ${maven.home}/repository
# -------------------------------------------------------------------
# M A V E N P L U G - I N D I R E C T O R Y
# -------------------------------------------------------------------
maven.plugin.dir = ${maven.home}/plugins
# -------------------------------------------------------------------
# M A V E N R E M O T E R E P O S
# -------------------------------------------------------------------
maven.repo.remote = http://www.ibiblio.org/maven
maven.repo.central = login.ibiblio.org
maven.repo.central.directory = /public/html/maven
maven.repo.remote.enabled = true
# -------------------------------------------------------------------
# M A V E N D I S T R I B U T I O N S
# -------------------------------------------------------------------
maven.distBuildDirectory = ${basedir}/target
maven.distBuildIndicator = DIST_BUILD_DIRECTORY
maven.distDirectory = ${basedir}/dist
# -------------------------------------------------------------------
# E N V I R O N M E N T D E P E N D E N T T O O L S
# -------------------------------------------------------------------
maven.scp.executable = scp
maven.ssh.executable = ssh
maven.build = MAVEN_BUILD_NOT_SET
maven.username=USERNAME_NOT_SET
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]