werken 2002/06/26 12:09:04
Modified: . maven.xml
src/java/org/apache/maven/app Maven.java
MavenJellyContext.java
src/templates/build/plugins/core default.properties
plugin.jelly
src/templates/build/plugins/test plugin.jelly
Log:
Fixed variable interpolation
Revision Changes Path
1.3 +2 -0 jakarta-turbine-maven/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/maven.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- maven.xml 22 Jun 2002 18:07:09 -0000 1.2
+++ maven.xml 26 Jun 2002 19:09:03 -0000 1.3
@@ -1,6 +1,7 @@
<project xmlns:j="jelly:core" default="maven:jar">
+<!--
<preGoal name="maven:compile">
<echo>
This is a callback before maven:compile
@@ -12,5 +13,6 @@
This is a callback after maven:compile
</echo>
</postGoal>
+-->
</project>
1.20 +39 -2 jakarta-turbine-maven/src/java/org/apache/maven/app/Maven.java
Index: Maven.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/Maven.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- Maven.java 25 Jun 2002 21:44:09 -0000 1.19
+++ Maven.java 26 Jun 2002 19:09:04 -0000 1.20
@@ -76,6 +76,10 @@
import org.apache.commons.jelly.tags.jeez.JeezTagLibrary;
import org.apache.commons.jelly.tags.werkz.JellySession;
import org.apache.commons.jelly.tags.werkz.JellyBuildListener;
+import org.apache.commons.jelly.expression.Expression;
+import org.apache.commons.jelly.expression.CompositeExpression;
+import org.apache.commons.jelly.expression.jexl.JexlExpressionFactory;
+
import org.apache.tools.ant.DemuxOutputStream;
@@ -746,6 +750,8 @@
*/
void loadPluginProperties(String name) throws IOException
{
+ System.err.println( "loadPluginProperties(" + name + ")" );
+
Properties props = getPluginProperties(name);
if (props == null)
@@ -758,14 +764,45 @@
Enumeration propNames = props.propertyNames();
String eachName = null;
+ String propText = null;
+ Object propVal = null;
+
+ JexlExpressionFactory factory = new JexlExpressionFactory();
while (propNames.hasMoreElements())
{
eachName = (String) propNames.nextElement();
+
+ System.err.println( name + " ${" + eachName + "}" );
+
if (context.getVariable(eachName) == null)
{
- context.setVariable(eachName,
- props.getProperty(eachName));
+ propText = props.getProperty(eachName);
+ System.err.println( "propText: " + propText );
+
+ try
+ {
+ Expression expr = CompositeExpression.parse( propText,
+ factory );
+
+ if (expr != null)
+ {
+ propVal = expr;
+ }
+ else
+ {
+ propVal = propText;
+ }
+
+ System.err.println( "propVal: " + propVal );
+
+ context.setVariable(eachName,
+ propVal );
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
}
}
}
1.5 +17 -4
jakarta-turbine-maven/src/java/org/apache/maven/app/MavenJellyContext.java
Index: MavenJellyContext.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/app/MavenJellyContext.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MavenJellyContext.java 24 Jun 2002 18:33:19 -0000 1.4
+++ MavenJellyContext.java 26 Jun 2002 19:09:04 -0000 1.5
@@ -58,6 +58,7 @@
import org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.TagLibrary;
+import org.apache.commons.jelly.expression.Expression;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectHelper;
@@ -173,11 +174,13 @@
*/
public Object getVariable(String name)
{
- Object value = super.getVariable(name);
+ Object value = this.props.get(name);
+ // Object value = super.getVariable(name);
if (value == null)
{
- value = this.props.get(name);
+ value = super.getVariable(name);
+ // value = this.props.get(name);
}
if (value instanceof String)
@@ -186,6 +189,10 @@
(String) value,
this.asProps);
}
+ else if ( value instanceof Expression )
+ {
+ value = ((Expression)value).evaluate( this );
+ }
return value;
}
@@ -199,11 +206,13 @@
*/
public Object getScopedVariable(String name)
{
- Object value = super.getScopedVariable(name);
+ Object value = this.props.get(name);
+ // Object value = super.getScopedVariable(name);
if (value == null)
{
- value = this.props.get(name);
+ value = super.getScopedVariable(name);
+ // value = this.props.get(name);
}
if (value instanceof String)
@@ -211,6 +220,10 @@
value = ProjectHelper.replaceProperties(getAntProject(),
(String) value,
this.asProps);
+ }
+ else if ( value instanceof Expression )
+ {
+ value = ((Expression)value).evaluate( this );
}
return value;
1.11 +3 -2
jakarta-turbine-maven/src/templates/build/plugins/core/default.properties
Index: default.properties
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/templates/build/plugins/core/default.properties,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- default.properties 22 Jun 2002 16:15:30 -0000 1.10
+++ default.properties 26 Jun 2002 19:09:04 -0000 1.11
@@ -55,7 +55,8 @@
# These names will actually be based on the versioning document
# that morgan checked into jakarta-site2 the other day.
#
-maven.final.name = ${maven.id}-${maven.currentVersion}
+#maven.final.name = ${maven.id}-${maven.currentVersion}
+maven.final.name = ${pom.id}-${pom.currentVersion}
maven.final.dir = ${basedir}/${maven.final.name}
#
@@ -153,4 +154,4 @@
# -------------------------------------------------------------------
# Mark the defaults as loaded - PLEASE DON'T OVERRIDE
# -------------------------------------------------------------------
-maven.defaults.loaded = true
\ No newline at end of file
+maven.defaults.loaded = true
1.5 +3 -0
jakarta-turbine-maven/src/templates/build/plugins/core/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/templates/build/plugins/core/plugin.jelly,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- plugin.jelly 25 Jun 2002 21:12:36 -0000 1.4
+++ plugin.jelly 26 Jun 2002 19:09:04 -0000 1.5
@@ -20,6 +20,8 @@
<!-- ================================================================== -->
<goal name="maven:prepare-filesystem">
+ <echo message="maven.build.dir= ${maven.build.dir}"/>
+ <echo message="maven.build.dest= ${maven.build.dest}"/>
<mkdir dir="${maven.build.dest}"/>
</goal>
@@ -77,6 +79,7 @@
<goal name="maven:jar"
description="Create the deliverable jar file."
prereqs="maven:test,maven:jar-resources">
+
<jar
jarfile="${maven.build.dir}/${maven.final.name}.jar"
basedir="${maven.build.dest}"
1.4 +5 -2
jakarta-turbine-maven/src/templates/build/plugins/test/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/templates/build/plugins/test/plugin.jelly,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- plugin.jelly 25 Jun 2002 21:06:55 -0000 1.3
+++ plugin.jelly 26 Jun 2002 19:09:04 -0000 1.4
@@ -52,12 +52,15 @@
</classpath>
<batchtest todir="${maven.test.reportsDirectory}">
<fileset dir="${pom.build.unitTestSourceDirectory}">
-<!--
<patternset refid="maven.unit.test.set"/>
--->
</fileset>
</batchtest>
</junit>
+
+ <echo message="fail: ${maven.test.failure}"/>
+ <j:if test="${maven.test.failure}">
+ <fail message="There were test failures."/>
+ </j:if>
</goal>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>