You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2002/12/06 17:32:26 UTC
cvs commit: jakarta-turbine-maven/src/plugins-build/xdoc project.xml
jvanzyl 2002/12/06 08:32:26
Modified: . maven.xml project.xml
src/java/org/apache/maven DependencyClasspathBuilder.java
Maven.java
src/java/org/apache/maven/jelly MavenJellyContext.java
src/java/org/apache/maven/jelly/tags/project MavenTag.java
ReactorTag.java
src/java/org/apache/maven/plugin PluginManager.java
src/java/org/apache/maven/project UnitTest.java
src/plugins-build/clover plugin.jelly
src/plugins-build/java plugin.jelly
src/plugins-build/test plugin.jelly project.xml
src/plugins-build/xdoc project.xml
Log:
o various fixes and cleanups
1) ${plugin.getDependencyPath('foo')} is fixed
2) test resources must be defined with <unitTest/>
3) fixed the logic inside the test plugin, it wasn't even working and
just plain failed with a specified test source directory that didn't
exist.
Revision Changes Path
1.63 +0 -2 jakarta-turbine-maven/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/maven.xml,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- maven.xml 3 Dec 2002 02:49:44 -0000 1.62
+++ maven.xml 6 Dec 2002 16:32:25 -0000 1.63
@@ -389,11 +389,9 @@
</preGoal>
-->
- <!--
<preGoal name="site:generate">
<attainGoal name="clover"/>
</preGoal>
- -->
<preGoal name="java:jar">
<copy todir="${maven.build.dest}/org/apache/maven/messages">
1.220 +0 -13 jakarta-turbine-maven/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/project.xml,v
retrieving revision 1.219
retrieving revision 1.220
diff -u -r1.219 -r1.220
--- project.xml 5 Dec 2002 15:55:35 -0000 1.219
+++ project.xml 6 Dec 2002 16:32:25 -0000 1.220
@@ -529,17 +529,10 @@
</dependencies>
<build>
-
<nagEmailAddress>turbine-maven-dev@jakarta.apache.org</nagEmailAddress>
-
<sourceDirectory>src/java</sourceDirectory>
-
<unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
- <integrationUnitTestSourceDirectory/>
- <aspectSourceDirectory></aspectSourceDirectory>
-
- <!-- Unit test classes -->
<unitTest>
<includes>
<include>**/*Test.java</include>
@@ -550,9 +543,6 @@
</excludes>
</unitTest>
- <!-- J A R R E S O U R C E S -->
- <!-- Resources that are packaged up inside the JAR file -->
-
<resources>
<includes>
<include>*.xsd</include>
@@ -563,9 +553,6 @@
<include>driver.properties</include>
</includes>
</resources>
-
- <jars>
- </jars>
</build>
<!-- For maven internal testing -->
1.2 +16 -3 jakarta-turbine-maven/src/java/org/apache/maven/DependencyClasspathBuilder.java
Index: DependencyClasspathBuilder.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/DependencyClasspathBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DependencyClasspathBuilder.java 5 Dec 2002 02:30:16 -0000 1.1
+++ DependencyClasspathBuilder.java 6 Dec 2002 16:32:25 -0000 1.2
@@ -59,6 +59,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.maven.project.Dependency;
+import org.apache.maven.project.Project;
import org.apache.maven.repository.Artifact;
import org.apache.maven.repository.DefaultArtifactFactory;
import org.apache.tools.ant.types.Path;
@@ -91,6 +92,8 @@
/** Reference id for the generated classpath. */
private String refid;
+ private Project project;
+
// --------------------------------------------------------------
// A C C E S S O R S
// --------------------------------------------------------------
@@ -115,6 +118,16 @@
return refid;
}
+ public void setProject( Project project )
+ {
+ this.project = project;
+ }
+
+ public Project getProject()
+ {
+ return project;
+ }
+
// --------------------------------------------------------------
// I M P L E M E N T A T I O N
// --------------------------------------------------------------
@@ -133,7 +146,7 @@
String mavenRepoLocal = getContext().getMavenRepoLocal();
Path classpath = new Path( getContext().getAntProject() );
- for ( Iterator i = getContext().getProject().getDependencies().iterator(); i.hasNext(); )
+ for ( Iterator i = getProject().getDependencies().iterator(); i.hasNext(); )
{
Dependency d = (Dependency) i.next();
@@ -165,7 +178,7 @@
}
classpath.append( path );
- getContext().getProject().setDependencyPath( d.getId(), path.toString() );
+ getProject().setDependencyPath( d.getId(), path.toString() );
}
if ( getRefid() != null )
1.8 +2 -1 jakarta-turbine-maven/src/java/org/apache/maven/Maven.java
Index: Maven.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/Maven.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Maven.java 5 Dec 2002 02:30:16 -0000 1.7
+++ Maven.java 6 Dec 2002 16:32:25 -0000 1.8
@@ -316,6 +316,7 @@
// values can be made available in the plugin.jelly script.
DependencyClasspathBuilder cdc = new DependencyClasspathBuilder();
cdc.setRefid( MavenConstants.DEPENDENCY_CLASSPATH );
+ cdc.setProject( getContext().getProject() );
cdc.setContext( getContext() );
cdc.execute();
}
1.18 +14 -13 jakarta-turbine-maven/src/java/org/apache/maven/jelly/MavenJellyContext.java
Index: MavenJellyContext.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jelly/MavenJellyContext.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- MavenJellyContext.java 5 Dec 2002 03:06:57 -0000 1.17
+++ MavenJellyContext.java 6 Dec 2002 16:32:25 -0000 1.18
@@ -78,6 +78,7 @@
import java.util.List;
import java.util.Set;
import java.util.ArrayList;
+import java.util.Iterator;
/** Specialized version of a <code>JellyContext</code>.
*
@@ -704,6 +705,7 @@
public void setDescriptorDirectory( File descriptorDirectory )
{
setVariable( MavenConstants.DESCRIPTOR_DIRECTORY, descriptorDirectory );
+ setVariable( "basedir", descriptorDirectory );
}
/**
@@ -772,23 +774,22 @@
*
* @param childBasedir Child's basedir.
* @param childProject Child's project.
- * @param parent Parent context.
* @return Child context.
*/
- public static MavenJellyContext createChild( File childBasedir,
- Project childProject,
- MavenJellyContext parent )
+ public MavenJellyContext createChild( File childBasedir, Project childProject )
{
- MavenJellyContext child = MavenUtils.createContext( childBasedir );
+ // In the case of the maven/reactor tag we do not want to inherit
+ // the context as we have a completely separate build. But we do
+ // want to pass on some system settings.
- // I can't seem to do the inherit thing property as i'm picking things up
- // from the parent project that i don't want when values are not present
- // in the child. So i need to populate some basic values here.
+ MavenJellyContext child = MavenUtils.createContext( childBasedir );
child.setProject( childProject );
- child.setXMLOutput( parent.getXMLOutput() );
- child.setDebugOn( parent.getDebugOn() );
- child.setEmacsModeOn( parent.getEmacsModeOn() );
- child.setOnline( parent.getOnline() );
+
+ // Set some basic system settings.
+ child.setXMLOutput( getXMLOutput() );
+ child.setDebugOn( getDebugOn() );
+ child.setEmacsModeOn( getEmacsModeOn() );
+ child.setOnline( getOnline() );
child.setDescriptorDirectory( childBasedir );
return child;
1.21 +3 -6 jakarta-turbine-maven/src/java/org/apache/maven/jelly/tags/project/MavenTag.java
Index: MavenTag.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jelly/tags/project/MavenTag.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- MavenTag.java 5 Dec 2002 03:06:57 -0000 1.20
+++ MavenTag.java 6 Dec 2002 16:32:25 -0000 1.21
@@ -154,10 +154,7 @@
File basedir = new File( project.getFile().getParent() );
Maven maven = new Maven();
-
- MavenJellyContext childContext = MavenJellyContext.createChild( basedir,
- project,
- parent.getContext() );
+ MavenJellyContext childContext = parent.getContext().createChild( basedir, project );
maven.setContext( childContext );
addGoals( maven );
@@ -257,7 +254,7 @@
*
* @param maven The maven project to add the goals to.
*/
- protected void addGoals( org.apache.maven.Maven maven )
+ protected void addGoals( Maven maven )
{
if ( goals != null )
{
1.8 +2 -3 jakarta-turbine-maven/src/java/org/apache/maven/jelly/tags/project/ReactorTag.java
Index: ReactorTag.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jelly/tags/project/ReactorTag.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ReactorTag.java 2 Dec 2002 01:17:50 -0000 1.7
+++ ReactorTag.java 6 Dec 2002 16:32:25 -0000 1.8
@@ -148,7 +148,6 @@
System.out.println( "+----------------------------------------" );
Maven maven = getMaven( output, p );
-
maven.initialize();
maven.verifyProject();
maven.attainGoals();
1.12 +33 -49 jakarta-turbine-maven/src/java/org/apache/maven/plugin/PluginManager.java
Index: PluginManager.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/plugin/PluginManager.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- PluginManager.java 5 Dec 2002 02:30:17 -0000 1.11
+++ PluginManager.java 6 Dec 2002 16:32:25 -0000 1.12
@@ -868,22 +868,45 @@
// loadPluginProperties(name);
File pluginDir = getPluginDir( name );
+
if ( log.isDebugEnabled() )
{
log.debug( "\n\nLOADING PLUGIN: " + name + " -> " + pluginDir );
}
+
Forehead.getInstance().getClassLoader( "root.maven" ).addURL( pluginDir.toURL() );
Project pluginProject = MavenUtils.getProject( new File( pluginDir, "project.xml" ) );
+ // For each plugin we create a new MavenJellyContext so that we
+ // can push in commonly named elements like ${plugin.dir} without
+ // the elements clobbering one another.
+ //MavenJellyContext pluginContext = getContext().createChild( pluginDir, pluginProject );
+ MavenJellyContext pluginContext = new MavenJellyContext( getContext() );
+ pluginContext.setInherit( true );
+
+ // These are properties taken from the <properties/> element
+ // in the plugin's project.xml.
Map pluginProperties = pluginProject.resolvedProperties();
- MavenUtils.integrateMapInContext( pluginProperties, getContext() );
+ MavenUtils.integrateMapInContext( pluginProperties, pluginContext );
+
+
+ pluginContext.setVariable( "plugin", pluginProject );
+ pluginContext.setVariable( "plugin.dir", getPluginDir( name ) );
+ pluginContext.addLazyTagLibraries( taglibsCache.keySet() );
+
+ // Create the dependency classpath for this plugin so that the
+ // values can be made available in the plugin.jelly script.
+ DependencyClasspathBuilder cdc = new DependencyClasspathBuilder();
+ cdc.setContext( pluginContext );
+ // We need to explicity set the project because we are dealing with
+ // the plugin project and we don't want the project taken from the
+ // context. To ensure the getDependencyPath(id) works from with
+ // the plugin.jelly scripts.
+ cdc.setProject( pluginProject );
+ cdc.execute();
- if ( !isPluginProcessed( name ) )
+ if ( isPluginProcessed( name ) == false )
{
- if ( log.isDebugEnabled() )
- {
- log.debug( "VERIFYING PLUGIN" );
- }
// Retrieve the dependencies that this plugin requires.
//getContext().getProjectVerifier().setMavenProject( pluginProject );
getContext().getProjectVerifier().execute();
@@ -892,37 +915,20 @@
createNewFile( getPluginProcessedMarker( name ) );
}
- if ( log.isDebugEnabled() )
- {
- log.debug( "Loading plugin dependencies:" );
- }
for ( Iterator i = pluginProject.getDependencies().iterator(); i.hasNext(); )
{
Dependency dependency = (Dependency) i.next();
- if ( log.isDebugEnabled() )
- {
- log.debug( "dependency: " + dependency.getId() );
- }
-
String classloader = dependency.getProperty( "classloader" );
- if ( log.isDebugEnabled() )
- {
- log.debug( "classloader: " + classloader );
- }
// Only add compile type dependencies to classloader
if ( classloader != null
- && ( dependency.isCompileType() || dependency.isTestType() ) )
+ &&
+ ( dependency.isCompileType() || dependency.isTestType() ) )
{
Artifact artifact = DefaultArtifactFactory.createArtifact( dependency );
String localRepo = getContext().getMavenRepoLocal();
File jarFile = new File( localRepo, artifact.getPath() );
- if ( log.isDebugEnabled() )
- {
- log.debug( "jarFile: " + jarFile );
- }
-
// We have the jar and the classloader to push it into so
// lets do it!
if ( jarFile.exists() )
@@ -940,31 +946,9 @@
}
}
- // For each plugin we create a new MavenJellyContext so that we
- // can push in commonly named elements like ${plugin.dir} without
- // the elements clobbering one another. Make sure to set inheritence
- // to true so that the outter context has access to variables and
- // taglibs set in the parent.
- MavenJellyContext pluginJellyContext = new MavenJellyContext( getContext() );
- pluginJellyContext.setInherit( true );
- pluginJellyContext.setVariable( "plugin.dir", getPluginDir( name ) );
- //pluginJellyContext.setProject( pluginProject );
-
- pluginJellyContext.addLazyTagLibraries( this.taglibsCache.keySet() );
-
- // Create the dependency classpath for this plugin so that the
- // values can be made available in the plugin.jelly script.
- DependencyClasspathBuilder cdc = new DependencyClasspathBuilder();
- cdc.setContext( pluginJellyContext );
- cdc.execute();
-
- // Place the plugin POM into the jelly context so it is
- // available in the plugin.jelly.
- pluginJellyContext.setVariable( "plugin", pluginProject );
-
JellyUtils.runScript( pluginScript,
getPluginDir( name ).toURL(),
- pluginJellyContext,
+ pluginContext,
getContext().getXMLOutput() );
}
1.8 +11 -1 jakarta-turbine-maven/src/java/org/apache/maven/project/UnitTest.java
Index: UnitTest.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/project/UnitTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- UnitTest.java 25 Nov 2002 19:05:23 -0000 1.7
+++ UnitTest.java 6 Dec 2002 16:32:25 -0000 1.8
@@ -81,7 +81,17 @@
{
this.resources.add( resource );
}
-
+
+ /**
+ * Set the resources.
+ *
+ * @param resources Test resources.
+ */
+ public void setResources( List resources )
+ {
+ this.resources = resources;
+ }
+
/**
* Gets the resources.
*
1.7 +1 -1 jakarta-turbine-maven/src/plugins-build/clover/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/clover/plugin.jelly,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- plugin.jelly 5 Sep 2002 17:48:23 -0000 1.6
+++ plugin.jelly 6 Dec 2002 16:32:25 -0000 1.7
@@ -48,7 +48,7 @@
name="clover:html-report"
prereqs="clover:on,test:test"
description="Generate HTML test coverage reports with Clover">
-
+
<mkdir dir="${maven.docs.dest}/clover"/>
<java classname="com.cortexeb.tools.clover.reporters.html.HtmlReporter"
1.33 +4 -1 jakarta-turbine-maven/src/plugins-build/java/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/java/plugin.jelly,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- plugin.jelly 23 Nov 2002 14:36:42 -0000 1.32
+++ plugin.jelly 6 Dec 2002 16:32:25 -0000 1.33
@@ -43,7 +43,10 @@
<goal name="java:compile"
description="Compile the project"
prereqs="java:prepare-filesystem">
-
+
+ <property name="paths" refid="maven.compile.src.set"/>
+ <echo>${paths}</echo>
+
<j:choose>
<j:when test="${sourcesPresent == 'true'}">
<javac
1.23 +52 -56 jakarta-turbine-maven/src/plugins-build/test/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/test/plugin.jelly,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- plugin.jelly 1 Nov 2002 16:52:25 -0000 1.22
+++ plugin.jelly 6 Dec 2002 16:32:26 -0000 1.23
@@ -18,9 +18,9 @@
description="Compile the TestCases and TestSuites"
prereqs="java:compile,java:jar-resources,test:prepare-filesystem,test:test-resources">
- <j:if test="${unitTestSourcesPresent}">
-
- <javac
+ <j:if test="${unitTestSourcesPresent == 'true'}">
+
+ <javac
destdir="${maven.test.dest}"
excludes="**/package.html"
debug="${maven.compile.debug}"
@@ -48,7 +48,7 @@
description="Test the application"
prereqs="test:compile">
- <j:if test="${unitTestSourcesPresent}">
+ <j:if test="${unitTestSourcesPresent == 'true'}">
<taskdef
name="junit"
@@ -125,7 +125,7 @@
description="Execute a single test defined using the 'testcase' variable"
prereqs="test:compile">
- <j:if test="${unitTestSourcesPresent}">
+ <j:if test="${unitTestSourcesPresent == 'true'}">
<j:choose>
<j:when test="${empty(testcase)}">
@@ -183,7 +183,7 @@
description="Execute all the tests matching the given 'testmatch' variable"
prereqs="test:compile">
- <j:if test="${unitTestSourcesPresent}">
+ <j:if test="${unitTestSourcesPresent == 'true'}">
<j:choose>
<j:when test="${empty(testmatch)}">
@@ -265,61 +265,57 @@
prereqs="test:prepare-filesystem"
xmlns:resources="resources">
- <j:if test="${unitTestSourcesPresent}">
+ <j:if test="${unitTestSourcesPresent == 'true'}">
- <define:taglib uri="resources">
-
- <!--
- - Copy all the file matched by each provided Resource to
- - the provided destination directory.
- -
- - @param resources A collection of pom Resource objects
- - @param todir Target directory
+ <define:taglib uri="resources">
+ <!--
+ - Copy all the file matched by each provided Resource to
+ - the provided destination directory.
+ -
+ - @param resources A collection of pom Resource objects
+ - @param todir Target directory
-->
- <define:tag name="copy">
- <copy todir="${todir}">
- <j:forEach var="res" items="${resources}">
- <fileset dir="${res.directory}">
- <j:forEach var="inc" items="${res.includes}">
- <include name="${inc}"/>
- </j:forEach>
- <j:forEach var="exc" items="${res.excludes}">
- <exclude name="${exc}"/>
- </j:forEach>
- </fileset>
- </j:forEach>
- </copy>
- </define:tag>
-
- </define:taglib>
-
- <!--
- - build.unitTest.resources
- -->
-
- <j:if test="${!pom.build.unitTest.resources.isEmpty()}">
-
- <resources:copy resources="${pom.build.unitTest.resources}"
- todir="${maven.test.dest}" />
-
- </j:if>
+ <define:tag name="copy">
+ <copy todir="${todir}">
+ <j:forEach var="res" items="${resources}">
+ <fileset dir="${res.directory}">
+ <j:forEach var="inc" items="${res.includes}">
+ <include name="${inc}"/>
+ </j:forEach>
+ <j:forEach var="exc" items="${res.excludes}">
+ <exclude name="${exc}"/>
+ </j:forEach>
+ </fileset>
+ </j:forEach>
+ </copy>
+ </define:tag>
+ </define:taglib>
- <!--
- - build.testResources also supported, but deprecated once
- - unitTest.resources is refit to follow the unified form
+ <!--
+ - build.unitTest.resources
-->
+
+ <echo> test dest ${maven.test.dest} </echo>
+
+ <j:if test="${!pom.build.unitTest.resources.isEmpty()}">
+
+ <!--
+ We have to test for this because it appears that if the
+ build/unitTest/resources is not set we end up with a value
+ of ''. This might not be jelly but the way the POM is processed
+ but this will fix it for now. jvz.
+ -->
+
+ <j:if test="${pom.build.unitTest.resources == ''}">
+
+ <resources:copy
+ resources="${pom.build.unitTest.resources}"
+ todir="${maven.test.dest}"
+ />
+
+ </j:if>
- <j:if test="${!pom.build.testResources.isEmpty()}">
-
- <echo>TestResources: ${pom.build.testResources}</echo>
-
- <resources:copy resources="${pom.build.testResources}"
- todir="${maven.test.dest}" />
-
- </j:if>
-
+ </j:if>
</j:if>
-
</goal>
-
</project>
1.14 +0 -11 jakarta-turbine-maven/src/plugins-build/test/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/test/project.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- project.xml 21 Nov 2002 04:54:26 -0000 1.13
+++ project.xml 6 Dec 2002 16:32:26 -0000 1.14
@@ -63,19 +63,8 @@
</dependencies>
<build>
-
<nagEmailAddress>turbine-maven-dev@jakarta.apache.org</nagEmailAddress>
-
<sourceDirectory>src/java</sourceDirectory>
-
- <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
- <!-- Unit test classes -->
- <unitTest>
- <includes>
- <include>**/*Test.java</include>
- </includes>
- </unitTest>
-
</build>
</project>
1.25 +0 -10 jakarta-turbine-maven/src/plugins-build/xdoc/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/xdoc/project.xml,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- project.xml 30 Nov 2002 17:21:07 -0000 1.24
+++ project.xml 6 Dec 2002 16:32:26 -0000 1.25
@@ -122,17 +122,7 @@
<build>
<nagEmailAddress>turbine-maven-dev@jakarta.apache.org</nagEmailAddress>
-
<sourceDirectory>src/java</sourceDirectory>
-
- <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
-
- <!-- Unit test classes -->
- <unitTest>
- <includes>
- <include>**/*Test.java</include>
- </includes>
- </unitTest>
</build>
</project>