You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by jd...@apache.org on 2005/02/25 06:09:14 UTC
cvs commit: maven-components/maven-core pom.xml
jdcasey 2005/02/24 21:09:14
Modified: maven-core/src/main/resources/META-INF/plexus plexus.xml
maven-mboot2/src/main/java MBoot.java
maven-core-it/it0015 expected-results.txt pom.xml
prebuild-hook.txt
maven-script/maven-script-marmalade/src/test/java/org/apache/maven/script/marmalade
MarmaladeMojoTest.java
maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags
MetadataTag.java
maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator
PluginDescriptorGenerator.java
maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade
MarmaladeMojo.java
maven-core-it README.txt integration-tests.txt
maven-core pom.xml
Added: maven-core-it/it0015/src/main/java/org/apache/maven/it0015
it0015.mmld
maven-core-it/it0015/src/main/resources/META-INF/marmalade
it0015.def
Log:
o Working on getting it0015 (marmalade-mojo support) working...nearly there, it0015 is still disabled.
Revision Changes Path
1.1 maven-components/maven-core-it/it0015/src/main/java/org/apache/maven/it0015/it0015.mmld
Index: it0015.mmld
===================================================================
<?xml version="1.0"?>
<mojo xmlns="marmalade:mojo" xmlns:marmalade-control="marmalade-control">
<metadata marmalade-control:el="none">
<id>it0015</id>
<goal>it0015</goal>
<description>Output a file with specified contents to [outDir]</description>
<parameters>
<parameter>
<name>outDir</name>
<expression>#project.build.directory</expression>
<default>target</default>
<description>Output directory for files.</description>
</parameter>
</parameters>
</metadata>
<execute>
<writeFile xmlns="marmalade:it0015" path="${outDir}/out.txt">This is a test.</writeFile>
</execute>
</mojo>
1.4 +7 -0 maven-components/maven-core/src/main/resources/META-INF/plexus/plexus.xml
Index: plexus.xml
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/resources/META-INF/plexus/plexus.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- plexus.xml 5 Dec 2004 04:16:04 -0000 1.3
+++ plexus.xml 25 Feb 2005 05:09:13 -0000 1.4
@@ -9,6 +9,13 @@
<component-discoverer implementation="org.apache.maven.plugin.MavenPluginDiscoverer"/>
</component-discoverers>
</component-discoverer-manager>
+ <component-factory-manager implementation="org.codehaus.plexus.component.factory.DefaultComponentFactoryManager">
+ <component-factories>
+ <component-factory implementation="org.codehaus.plexus.component.factory.marmalade.MarmaladeClasspathComponentFactory">
+ <id>marmalade</id>
+ </component-factory>
+ </component-factories>
+ </component-factory-manager>
<components>
<component>
<role>org.apache.maven.plugin.PluginManager</role>
1.50 +1 -15 maven-components/maven-mboot2/src/main/java/MBoot.java
Index: MBoot.java
===================================================================
RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/MBoot.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- MBoot.java 24 Feb 2005 07:53:01 -0000 1.49
+++ MBoot.java 25 Feb 2005 05:09:13 -0000 1.50
@@ -51,7 +51,7 @@
String[] plexusDeps = new String[] {
"classworlds/jars/classworlds-1.1-SNAPSHOT.jar",
- "plexus/jars/plexus-container-default-1.0-alpha-2-SNAPSHOT.jar", };
+ "plexus/jars/plexus-container-default-1.0-alpha-2-SNAPSHOT.jar" };
String[] pluginGeneratorDeps = new String[] {
"plexus/jars/plexus-container-default-1.0-alpha-2-SNAPSHOT.jar",
@@ -62,12 +62,6 @@
"maven/jars/maven-plugin-tools-java-2.0-SNAPSHOT.jar",
"maven/jars/maven-plugin-tools-pluggy-2.0-SNAPSHOT.jar" };
- String[] mojoSupportDeps = new String[] {
- "marmalade/jars/marmalade-core-1.0-alpha2-SNAPSHOT.jar",
- "xpp3/jars/xpp3-1.1.3.3.jar",
- "plexus/jars/plexus-marmalade-factory-1.0-alpha-2-SNAPSHOT.jar",
- "maven/jars/maven-script-marmalade-2.0-SNAPSHOT.jar", };
-
// ----------------------------------------------------------------------
// These are modello's runtime dependencies
// ----------------------------------------------------------------------
@@ -367,14 +361,6 @@
FileUtils.copyFileToDirectory( repoLocal + "/" + getArtifactPath( d, "/" ), lib );
}
- // Copy in deps used for non-java mojo support.
-/* Causing issues
- for ( int i = 0; i < mojoSupportDeps.length; i++ )
- {
- FileUtils.copyFileToDirectory( repoLocal + "/" + mojoSupportDeps[i], lib );
- }
-*/
-
// Copy maven itself
FileUtils.copyFileToDirectory( repoLocal + "/maven/jars/maven-core-2.0-SNAPSHOT.jar", lib );
1.2 +1 -1 maven-components/maven-core-it/it0015/expected-results.txt
Index: expected-results.txt
===================================================================
RCS file: /home/cvs/maven-components/maven-core-it/it0015/expected-results.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- expected-results.txt 25 Feb 2005 02:34:42 -0000 1.1
+++ expected-results.txt 25 Feb 2005 05:09:14 -0000 1.2
@@ -1 +1 @@
-target/classes/out.txt
+target/out.txt
1.2 +16 -1 maven-components/maven-core-it/it0015/pom.xml
Index: pom.xml
===================================================================
RCS file: /home/cvs/maven-components/maven-core-it/it0015/pom.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- pom.xml 25 Feb 2005 02:34:42 -0000 1.1
+++ pom.xml 25 Feb 2005 05:09:14 -0000 1.2
@@ -1,13 +1,28 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>maven</groupId>
- <artifactId>maven-it0014-plugin</artifactId>
+ <artifactId>maven-it0015-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
+ <type>plugin</type>
<dependencies>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>marmalade</groupId>
+ <artifactId>marmalade-core</artifactId>
+ <version>1.0-alpha2-SNAPSHOT</version>
+ </dependency>
</dependencies>
+ <build>
+ <resources>
+ <resource><directory>src/main/resources</directory></resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes><include>**/*.mmld</include></includes>
+ </resource>
+ </resources>
+ </build>
</project>
1.2 +1 -1 maven-components/maven-core-it/it0015/prebuild-hook.txt
Index: prebuild-hook.txt
===================================================================
RCS file: /home/cvs/maven-components/maven-core-it/it0015/prebuild-hook.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- prebuild-hook.txt 25 Feb 2005 02:34:42 -0000 1.1
+++ prebuild-hook.txt 25 Feb 2005 05:09:14 -0000 1.2
@@ -1 +1 @@
-rm target/classes/out.txt
+rm target/out.txt
1.2 +5 -2 maven-components/maven-script/maven-script-marmalade/src/test/java/org/apache/maven/script/marmalade/MarmaladeMojoTest.java
Index: MarmaladeMojoTest.java
===================================================================
RCS file: /home/cvs/maven-components/maven-script/maven-script-marmalade/src/test/java/org/apache/maven/script/marmalade/MarmaladeMojoTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MarmaladeMojoTest.java 24 Feb 2005 05:12:30 -0000 1.1
+++ MarmaladeMojoTest.java 25 Feb 2005 05:09:14 -0000 1.2
@@ -36,7 +36,7 @@
extends TestCase
{
- private static final String TEST_SCRIPT = "<set xmlns=\"marmalade:core\" var=\"testvar\" value=\"testval\" extern=\"true\"/>";
+ private static final String TEST_SCRIPT = "<set xmlns=\"marmalade:core\" var=\"testvar\" value=\"${param}/testval\" extern=\"true\"/>";
public void testShouldProduceOutputWithRequest_Dot_ToStringInline() throws Exception
{
@@ -51,12 +51,15 @@
MarmaladeMojo mojo = new MarmaladeMojo( script );
PluginExecutionRequest request = new PluginExecutionRequest( Collections.EMPTY_MAP );
+ request.setParameters(Collections.singletonMap("param", "paramValue"));
+
PluginExecutionResponse response = new PluginExecutionResponse();
mojo.execute( request, response );
Object result = request.getContextValue( "testvar" );
- System.out.println( "Result of script execution: " + result );
+
+ assertEquals("paramValue/testval", result);
}
}
\ No newline at end of file
1.2 +37 -5 maven-components/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MetadataTag.java
Index: MetadataTag.java
===================================================================
RCS file: /home/cvs/maven-components/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MetadataTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MetadataTag.java 24 Feb 2005 05:12:28 -0000 1.1
+++ MetadataTag.java 25 Feb 2005 05:09:14 -0000 1.2
@@ -71,17 +71,44 @@
MojoDescriptor descriptor = new MojoDescriptor();
descriptor.setLanguage( "marmalade" );
- descriptor.setId( id );
- descriptor.setGoal( goal );
- descriptor.setDescription( description );
- descriptor.setExecutionStrategy( executionStrategy );
- descriptor.setInstantiationStrategy( instantiationStrategy );
+
+ if ( notEmpty( id ) )
+ {
+ descriptor.setId( id );
+ }
+
+ if ( notEmpty( goal ) )
+ {
+ descriptor.setGoal( goal );
+ }
+
+ if ( notEmpty( description ) )
+ {
+ descriptor.setDescription( description );
+ }
+
+ if ( notEmpty( executionStrategy ) )
+ {
+ descriptor.setExecutionStrategy( executionStrategy );
+ }
+
+ if ( notEmpty( instantiationStrategy ) )
+ {
+ descriptor.setInstantiationStrategy( instantiationStrategy );
+ }
+
descriptor.setParameters( parameters );
descriptor.setRequiresDependencyResolution( requiresDependencyResolution );
descriptor.setRequiresProject( requiresProject );
String basePath = (String) context.getVariable( MarmaladeMojoExecutionDirectives.SCRIPT_BASEPATH_INVAR,
getExpressionEvaluator() );
+
+ if(basePath.endsWith("/"))
+ {
+ basePath = basePath.substring(0, basePath.length()-2);
+ }
+
String implementationPath = getTagInfo().getSourceFile().substring( basePath.length() );
descriptor.setImplementation( implementationPath );
@@ -89,6 +116,11 @@
return descriptor;
}
+ private boolean notEmpty( String test )
+ {
+ return test != null && test.trim().length() > 0;
+ }
+
public void setId( String id )
{
this.id = id;
1.3 +10 -0 maven-components/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
Index: PluginDescriptorGenerator.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PluginDescriptorGenerator.java 24 Feb 2005 05:12:29 -0000 1.2
+++ PluginDescriptorGenerator.java 25 Feb 2005 05:09:14 -0000 1.3
@@ -108,6 +108,16 @@
w.writeText( mojoDescriptor.getImplementation() );
w.endElement();
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+ w.startElement( "language" );
+
+ w.writeText( mojoDescriptor.getLanguage() );
+
+ w.endElement();
// ----------------------------------------------------------------------
//
1.5 +2 -1 maven-components/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/MarmaladeMojo.java
Index: MarmaladeMojo.java
===================================================================
RCS file: /home/cvs/maven-components/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/MarmaladeMojo.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MarmaladeMojo.java 25 Feb 2005 03:17:27 -0000 1.4
+++ MarmaladeMojo.java 25 Feb 2005 05:09:14 -0000 1.5
@@ -45,7 +45,7 @@
public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) throws Exception
{
- MarmaladeExecutionContext context = new DefaultContext();
+ MarmaladeExecutionContext context = new DefaultContext( request.getParameters() );
context.setVariable( MarmaladeMojoExecutionDirectives.REQUEST_INVAR, request );
context.setVariable( MarmaladeMojoExecutionDirectives.RESPONSE_INVAR, response );
@@ -64,6 +64,7 @@
for ( Iterator it = externalizedVars.entrySet().iterator(); it.hasNext(); )
{
Map.Entry entry = (Map.Entry) it.next();
+
request.addContextValue( entry.getKey(), entry.getValue() );
}
}
1.1 maven-components/maven-core-it/it0015/src/main/resources/META-INF/marmalade/it0015.def
Index: it0015.def
===================================================================
org.apache.maven.it0015.tags.IT0015TagLibrary
1.15 +9 -1 maven-components/maven-core-it/README.txt
Index: README.txt
===================================================================
RCS file: /home/cvs/maven-components/maven-core-it/README.txt,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- README.txt 3 Feb 2005 20:54:15 -0000 1.14
+++ README.txt 25 Feb 2005 05:09:14 -0000 1.15
@@ -38,10 +38,18 @@
maven-component, which is the parent of maven-plugin, which is an
explicit dependency of this test.
-it0011: Test specification of dependency versions via <dependencyDefaults/>.
+it0011: Test specification of dependency versions via <dependencyManagement/>.
it0012: Test simple POM interpolation
+it0013: Test plugin-plugin, which tests maven-plugin-tools-api and
+ maven-plugin-tools-java. This will generate a plugin descriptor from
+ java-based mojo sources, install the plugin, and then use it.
+
+it0015: Test marmalade-driven mojo support. This will compile supporting java
+ classes (mmld tag & taglib), generate plugin descriptor from mmld script,
+ install the plugin, and finally use the new plugin.
+
-------------------------------------------------------------------------------
- generated sources
1.14 +2 -0 maven-components/maven-core-it/integration-tests.txt
Index: integration-tests.txt
===================================================================
RCS file: /home/cvs/maven-components/maven-core-it/integration-tests.txt,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- integration-tests.txt 24 Feb 2005 02:51:00 -0000 1.13
+++ integration-tests.txt 25 Feb 2005 05:09:14 -0000 1.14
@@ -12,3 +12,5 @@
it0011
it0012
it0013
+#it0014
+#it0015
1.17 +20 -0 maven-components/maven-core/pom.xml
Index: pom.xml
===================================================================
RCS file: /home/cvs/maven-components/maven-core/pom.xml,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- pom.xml 23 Feb 2005 00:06:06 -0000 1.16
+++ pom.xml 25 Feb 2005 05:09:14 -0000 1.17
@@ -57,6 +57,26 @@
<artifactId>wagon-http-lightweight</artifactId>
<version>1.0-alpha-2-SNAPSHOT</version>
</dependency>
+ <!-- Added to support marmalade-mojos.
+ | Currently plexus container cannot accommodate multiple plexus.xml files,
+ | so we have to include marmalade support here. Will remove when plexus
+ | container is fixed (post-alpha-1 m2 release). -->
+ <dependency>
+ <groupId>plexus</groupId>
+ <artifactId>plexus-marmalade-factory</artifactId>
+ <version>1.0-alpha-2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>marmalade</groupId>
+ <artifactId>marmalade-core</artifactId>
+ <version>1.0-alpha2-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>xpp3</groupId>
+ <artifactId>xpp3</artifactId>
+ <version>1.1.3.3</version>
+ </dependency>
+ <!-- End marmalade support deps. -->
</dependencies>
<distributionManagement>
<site>