brett 2005/03/21 22:38:50
Modified: maven-core-it-plugin pom.xml
maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit
CoreItMojo.java
Log:
add more functionality for testing configuration
Revision Changes Path
1.3 +2 -2 maven-components/maven-core-it-plugin/pom.xml
Index: pom.xml
===================================================================
RCS file: /home/cvs/maven-components/maven-core-it-plugin/pom.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- pom.xml 10 Mar 2005 01:35:23 -0000 1.2
+++ pom.xml 22 Mar 2005 06:38:50 -0000 1.3
@@ -7,8 +7,8 @@
<modelVersion>4.0.0</modelVersion>
<groupId>maven</groupId>
<artifactId>maven-core-it-plugin</artifactId>
- <packaging>plugin</packaging>
+ <packaging>maven-plugin</packaging>
<name>Maven Core Integration Test Plugin</name>
<version>1.0-SNAPSHOT</version>
<inceptionYear>2001</inceptionYear>
-</model>
\ No newline at end of file
+</model>
1.4 +35 -28
maven-components/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
Index: CoreItMojo.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core-it-plugin/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CoreItMojo.java 13 Mar 2005 21:06:06 -0000 1.3
+++ CoreItMojo.java 22 Mar 2005 06:38:50 -0000 1.4
@@ -45,50 +45,57 @@
* validator=""
* expression="target/test-basedir-alignment"
* description=""
+ *
+ * @parameter name="pluginItem" type="String" required="false" validator=""
description="" expression="" defaultValue="foo"
+ * @parameter name="goalItem" type="String" required="false" validator=""
description="" expression="bar"
*/
public class CoreItMojo
extends AbstractPlugin
{
- private static final int DELETE_RETRY_SLEEP_MILLIS = 10;
+ private String outputDirectory;
+
+ private File basedirAlignmentDirectory;
+
+ private String pluginItem;
+
+ private String goalItem;
public void execute( PluginExecutionRequest request,
PluginExecutionResponse response )
throws Exception
{
- String outputDirectory = (String) request.getParameter(
"outputDirectory" );
+ touch( new File( outputDirectory ), "touch.txt" );
- File f = new File( outputDirectory );
-
- if ( !f.exists() )
- {
- f.mkdirs();
- }
-
- File touch = new File( f, "touch.txt" );
-
- FileWriter w = new FileWriter( touch );
-
- w.write( "touch.txt" );
-
- w.close();
-
// This parameter should be aligned to the basedir as the parameter
type is specified
// as java.io.File
- String basedirAlignmentDirectory = (String) request.getParameter(
"basedirAlignmentDirectory" );
+ touch( basedirAlignmentDirectory, "touch.txt" );
- f = new File( basedirAlignmentDirectory );
-
- if ( !f.exists() )
+ // Test parameter setting
+ if ( pluginItem != null )
{
- f.mkdirs();
- }
-
- touch = new File( f, "touch.txt" );
+ touch( new File( outputDirectory ), pluginItem );
+ }
+
+ if ( goalItem != null )
+ {
+ touch( new File( outputDirectory ), goalItem );
+ }
+ }
+
+ private static void touch( File dir, String file )
+ throws Exception
+ {
+ if ( !dir.exists() )
+ {
+ dir.mkdirs();
+ }
- w = new FileWriter( touch );
+ File touch = new File( dir, file );
+
+ FileWriter w = new FileWriter( touch );
- w.write( "touch.txt" );
+ w.write( file );
- w.close();
+ w.close();
}
}