Author: jvanzyl
Date: Sat Oct 21 14:49:40 2006
New Revision: 466576
URL: http://svn.apache.org/viewvc?view=rev&rev=466576
Log: (empty)
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/pom.xml
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CatchMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItForkerMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItGoalForkerMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedEnvarConfigurationMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedPomConfigurationMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/LoadableMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/NoProjectMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ParameterImplementationMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ReachableMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/RunnableMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ThrowMojo.java
(with props)
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/TrickyParameterMojo.java
(with props)
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/pom.xml
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/pom.xml?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/pom.xml
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/pom.xml
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ Copyright 2005-2006 The Apache Software Foundation.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>maven-plugins</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>3</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>maven-core-it-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Maven Core Integration Test Plugin</name>
+ <version>1.0-SNAPSHOT</version>
+ <inceptionYear>2006</inceptionYear>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-archiver</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ <version>0.9.1</version>
+ </dependency>
+ <dependency>
+ <groupId>bsh</groupId>
+ <artifactId>bsh</artifactId>
+ <version>1.3.0</version>
+ </dependency>
+ </dependencies>
+</project>
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CatchMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CatchMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CatchMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CatchMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,78 @@
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * "Catch" a parameter "thrown" by the ThrowMojo through the plugin context,
and
+ * write a file based on it's value to the build output directory.
+ *
+ * @goal catch
+ */
+public class CatchMojo
+ extends AbstractMojo
+{
+
+ /**
+ * @parameter expression="${project.build.directory}"
+ * @required
+ * @readonly
+ */
+ private File outDir;
+
+ public File getOutDir()
+ {
+ return outDir;
+ }
+
+ public void setOutDir( File outDir )
+ {
+ this.outDir = outDir;
+ }
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ String value = (String) getPluginContext().get(
ThrowMojo.THROWN_PARAMETER );
+
+ if ( !outDir.exists() )
+ {
+ outDir.mkdirs();
+ }
+
+ File outfile = new File( outDir, value );
+
+ Writer writer = null;
+ try
+ {
+ writer = new FileWriter( outfile );
+
+ writer.write( value );
+
+ writer.flush();
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Cannot write output file: " +
outfile, e );
+ }
+ finally
+ {
+ if ( writer != null )
+ {
+ try
+ {
+ writer.close();
+ }
+ catch ( IOException e )
+ {
+ }
+ }
+ }
+ }
+
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CatchMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CatchMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItForkerMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItForkerMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItForkerMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItForkerMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,54 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @goal fork
+ *
+ * @execute phase="generate-sources" lifecycle="foo"
+ */
+public class CoreItForkerMojo
+ extends AbstractMojo
+{
+ /**
+ * @parameter expression="${project}"
+ */
+ private MavenProject project;
+
+ /**
+ * @parameter expression="${executedProject}"
+ */
+ private MavenProject executedProject;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ if ( !executedProject.getBuild().getFinalName().equals( "coreitified"
) )
+ {
+ throw new MojoExecutionException( "Unexpected result, final name
of executed project is " + executedProject.getBuild().getFinalName() );
+ }
+
+ if ( project.getBuild().getFinalName().equals( "coreitified" ) )
+ {
+ throw new MojoExecutionException( "forked project was polluted" );
+ }
+ }
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItForkerMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItForkerMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItGoalForkerMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItGoalForkerMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItGoalForkerMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItGoalForkerMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,54 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @goal fork-goal
+ *
+ * @execute goal="touch"
+ */
+public class CoreItGoalForkerMojo
+ extends AbstractMojo
+{
+ /**
+ * @parameter expression="${project}"
+ */
+ private MavenProject project;
+
+ /**
+ * @parameter expression="${executedProject}"
+ */
+ private MavenProject executedProject;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ if ( !executedProject.getBuild().getFinalName().equals( "coreitified"
) )
+ {
+ throw new MojoExecutionException( "Unexpected result, final name
of executed project is " + executedProject.getBuild().getFinalName() );
+ }
+
+ if ( project.getBuild().getFinalName().equals( "coreitified" ) )
+ {
+ throw new MojoExecutionException( "forked project was polluted" );
+ }
+ }
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItGoalForkerMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItGoalForkerMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,151 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * @goal touch
+ *
+ * @phase process-sources
+ *
+ * @description Goal which cleans the build
+ */
+public class CoreItMojo
+ extends AbstractMojo
+{
+ /**
+ * @parameter expression="${project}"
+ */
+ private MavenProject project;
+
+ /**
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ private String outputDirectory;
+
+ /** Test setting of plugin-artifacts on the PluginDescriptor instance.
+ * @parameter expression="${plugin.artifactMap}"
+ * @required
+ */
+ private Map pluginArtifacts;
+
+ /**
+ * @parameter expression="target/test-basedir-alignment"
+ */
+ private File basedirAlignmentDirectory;
+
+ /**
+ * @parameter alias="pluginFile"
+ */
+ private String pluginItem = "foo";
+
+ /**
+ * @parameter
+ */
+ private String goalItem = "bar";
+
+ /**
+ * @parameter expression="${artifactToFile}"
+ */
+ private String artifactToFile;
+
+ /**
+ * @parameter expression="${fail}"
+ */
+ private boolean fail = false;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ if ( fail )
+ {
+ throw new MojoExecutionException( "Failing per \'fail\' parameter
(specified in pom or system properties)" );
+ }
+
+ touch( new File( outputDirectory ), "touch.txt" );
+
+ // This parameter should be aligned to the basedir as the parameter
type is specified
+ // as java.io.File
+
+ if ( basedirAlignmentDirectory.getPath().equals(
"target/test-basedir-alignment" ) )
+ {
+ throw new MojoExecutionException( "basedirAlignmentDirectory not
aligned" );
+ }
+
+ touch( basedirAlignmentDirectory, "touch.txt" );
+
+ File outDir = new File( outputDirectory );
+
+ // Test parameter setting
+ if ( pluginItem != null )
+ {
+ touch( outDir, pluginItem );
+ }
+
+ if ( goalItem != null )
+ {
+ touch( outDir, goalItem );
+ }
+
+ if ( artifactToFile != null )
+ {
+ Artifact artifact = (Artifact) pluginArtifacts.get( artifactToFile
);
+
+ File artifactFile = artifact.getFile();
+
+ String filename = artifactFile.getAbsolutePath().replace('/',
'_').replace(':', '_') + ".txt";
+
+ touch( outDir, filename );
+ }
+
+ project.getBuild().setFinalName( "coreitified" );
+ }
+
+ private static void touch( File dir, String file )
+ throws MojoExecutionException
+ {
+ try
+ {
+ if ( !dir.exists() )
+ {
+ dir.mkdirs();
+ }
+
+ File touch = new File( dir, file );
+
+ FileWriter w = new FileWriter( touch );
+
+ w.write( file );
+
+ w.close();
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Error touching file", e );
+ }
+ }
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2005 Your Corporation. All Rights Reserved.
+ */
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ * @goal setter-touch
+ *
+ * @description Goal which cleans the build
+ */
+public class CoreItMojoWithSetters
+ extends AbstractMojo
+{
+ /**
+ * @parameter
+ * property="outputDirectory"
+ * expression="${project.build.directory}"
+ * @required
+ */
+ private String outputDirectoryValue;
+
+ /**
+ * @parameter property="foo"
+ */
+ private String fooValue;
+
+ /**
+ * @parameter
+ */
+ private String bar;
+
+ // ----------------------------------------------------------------------
+ // Setters
+ // ----------------------------------------------------------------------
+
+ public void setOutputDirectory( String outputDirectory )
+ {
+ this.outputDirectoryValue = outputDirectory;
+ }
+
+ boolean setFooSetterExecuted;
+
+ public void setFoo( String fooValue )
+ {
+ this.fooValue = fooValue;
+
+ setFooSetterExecuted = true;
+ }
+
+ boolean setBarSetterExecuted;
+
+ public void setBar( String barValue )
+ {
+ this.bar = barValue + ".baz";
+
+ setBarSetterExecuted = true;
+ }
+
+ // ----------------------------------------------------------------------
+ //
+ // ----------------------------------------------------------------------
+
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ touch( new File( outputDirectoryValue ), "touch.txt" );
+
+ File outDir = new File( outputDirectoryValue );
+
+ // Test parameter setting
+ if ( fooValue != null && setFooSetterExecuted )
+ {
+ touch( outDir, fooValue );
+ }
+
+ if ( bar != null && setBarSetterExecuted )
+ {
+ touch( outDir, bar );
+ }
+ }
+
+ private static void touch( File dir, String file )
+ throws MojoExecutionException
+ {
+ try
+ {
+ if ( !dir.exists() )
+ {
+ dir.mkdirs();
+ }
+
+ File touch = new File( dir, file );
+
+ FileWriter w = new FileWriter( touch );
+
+ w.write( file );
+
+ w.close();
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Error touching file", e );
+ }
+ }
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/CoreItMojoWithSetters.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedEnvarConfigurationMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedEnvarConfigurationMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedEnvarConfigurationMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedEnvarConfigurationMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,52 @@
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.util.Properties;
+import java.io.FileOutputStream;
+import java.io.File;
+
+/**
+ * Interpolate some envars that are embedded in the POM and make sure they
pass through
+ * the system.
+ *
+ * @goal generate-envar-properties
+ */
+public class InterpolatedEnvarConfigurationMojo
+ extends AbstractMojo
+{
+ /**
+ * @parameter expression="${basedir}"
+ */
+ private String basedir;
+
+ /**
+ * @parameter expression="${mavenTestEnvar}"
+ */
+ private String mavenTestEnvar;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ if ( mavenTestEnvar == null )
+ {
+ throw new MojoExecutionException( "The mavenTestEnvar field should
not be null! You must run this using the maven-core-it scripts! ");
+ }
+
+ try
+ {
+ Properties mojoGeneratedPropeties = new Properties();
+
+ mojoGeneratedPropeties.put( "maven.test.envar", mavenTestEnvar );
+
+ FileOutputStream fos = new FileOutputStream( new File( basedir,
"target/mojo-generated.properties" ) );
+
+ mojoGeneratedPropeties.store( fos, "# Properties generated by the
execution of a mojo that uses interpolated envar values." );
+ }
+ catch( Exception e )
+ {
+ getLog().error( "Error creating mojo generated properties.", e );
+ }
+ }
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedEnvarConfigurationMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedEnvarConfigurationMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedPomConfigurationMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedPomConfigurationMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedPomConfigurationMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedPomConfigurationMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,65 @@
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.util.Properties;
+import java.io.FileOutputStream;
+import java.io.File;
+
+/**
+ * Take some configuration values that use interpolated POM values and write
them to a properties file
+ * to make sure they are passing through the system properly. We have reports
(MNG-1927) that we're
+ *
+ * @goal generate-properties
+ */
+public class InterpolatedPomConfigurationMojo
+ extends AbstractMojo
+{
+ /**
+ * @parameter expression="${basedir}"
+ */
+ private String basedir;
+
+ /**
+ * @parameter expression="${projectBuildDirectory}"
+ */
+ private String projectBuildDirectory;
+
+ /**
+ * @parameter expression="${targetDirectoryString}"
+ */
+ private String targetDirectoryString;
+
+ /**
+ * @parameter expression="${targetDirectoryFile}"
+ */
+ private File targetDirectoryFile;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ try
+ {
+ Properties mojoGeneratedPropeties = new Properties();
+
+ mojoGeneratedPropeties.put( "project.build.directory",
projectBuildDirectory );
+ if ( targetDirectoryString != null )
+ {
+ mojoGeneratedPropeties.put( "targetDirectoryString",
targetDirectoryString );
+ }
+ if ( targetDirectoryFile != null )
+ {
+ mojoGeneratedPropeties.put( "targetDirectoryFile",
targetDirectoryFile.getAbsolutePath() );
+ }
+
+ FileOutputStream fos = new FileOutputStream( new File( basedir,
"target/mojo-generated.properties" ) );
+
+ mojoGeneratedPropeties.store( fos, "# Properties generated by the
execution of a mojo that uses interpolated POM values for configuration." );
+ }
+ catch( Exception e )
+ {
+ getLog().error( "Error creating mojo generated properties.", e );
+ }
+ }
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedPomConfigurationMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/InterpolatedPomConfigurationMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/LoadableMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/LoadableMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/LoadableMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/LoadableMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,59 @@
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * @goal loadable
+ * @requiresDependencyResolution test
+ */
+public class LoadableMojo
+ extends AbstractMojo
+{
+ /**
+ * @parameter
+ * @required
+ */
+ private String className;
+
+ public void execute() throws MojoFailureException
+ {
+ if ( !load( true ) || !load( false ) )
+ {
+ throw new MojoFailureException( this, "Class-loading test
failed..", "Failed to load class: " + className + " using one or more methods."
);
+ }
+ }
+
+ private boolean load( boolean useContextClassloader ) throws
MojoFailureException
+ {
+ getLog().info( "Executing in java version: " + System.getProperty(
"java.version" ) );
+
+ ClassLoader cl;
+ if ( useContextClassloader )
+ {
+ cl = Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ cl = this.getClass().getClassLoader();
+ }
+
+ getLog().info( "Attepting to load: " + className + " from: " + cl +
(useContextClassloader ? " (context classloader)" : "" ) );
+
+ try
+ {
+ Class result = cl.loadClass( className );
+
+ getLog().info( "Load succeeded." );
+
+ return true;
+ }
+ catch ( ClassNotFoundException e )
+ {
+ getLog().info( "Failed to load class: " + className
+ + (useContextClassloader ? " using context classloader" : "")
);
+
+ return false;
+ }
+ }
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/LoadableMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/LoadableMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/NoProjectMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/NoProjectMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/NoProjectMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/NoProjectMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,143 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * Mojo which touches a file without requiring a project.
+ *
+ * @goal light-touch
+ * @requiresProject false
+ *
+ */
+public class NoProjectMojo
+ extends AbstractMojo
+{
+ /**
+ * @parameter expression="${project}"
+ */
+ private MavenProject project;
+
+ /**
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ private String outputDirectory;
+
+ /** Test setting of plugin-artifacts on the PluginDescriptor instance.
+ * @parameter expression="${plugin.artifactMap}"
+ * @required
+ */
+ private Map pluginArtifacts;
+
+ /**
+ * @parameter expression="target/test-basedir-alignment"
+ */
+ private File basedirAlignmentDirectory;
+
+ /**
+ * @parameter
+ */
+ private String pluginItem = "foo";
+
+ /**
+ * @parameter
+ */
+ private String goalItem = "bar";
+
+ /**
+ * @parameter expression="${artifactToFile}"
+ */
+ private String artifactToFile;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ touch( new File( outputDirectory ), "touch.txt" );
+
+ // This parameter should be aligned to the basedir as the parameter
type is specified
+ // as java.io.File
+
+ if ( basedirAlignmentDirectory.getPath().equals(
"target/test-basedir-alignment" ) )
+ {
+ throw new MojoExecutionException( "basedirAlignmentDirectory not
aligned" );
+ }
+
+ touch( basedirAlignmentDirectory, "touch.txt" );
+
+ File outDir = new File( outputDirectory );
+
+ // Test parameter setting
+ if ( pluginItem != null )
+ {
+ touch( outDir, pluginItem );
+ }
+
+ if ( goalItem != null )
+ {
+ touch( outDir, goalItem );
+ }
+
+ if ( artifactToFile != null )
+ {
+ Artifact artifact = (Artifact) pluginArtifacts.get( artifactToFile
);
+
+ File artifactFile = artifact.getFile();
+
+ String filename = artifactFile.getAbsolutePath().replace('/',
'_').replace(':', '_') + ".txt";
+
+ touch( outDir, filename );
+ }
+
+ project.getBuild().setFinalName( "coreitified" );
+ }
+
+ private void touch( File dir, String file )
+ throws MojoExecutionException
+ {
+ try
+ {
+ if ( !dir.exists() )
+ {
+ dir.mkdirs();
+ }
+
+ File touch = new File( dir, file );
+
+ getLog().info( "Touching: " + touch );
+
+ FileWriter w = new FileWriter( touch );
+
+ w.write( file );
+
+ w.close();
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Error touching file", e );
+ }
+ }
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/NoProjectMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/NoProjectMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,81 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.archiver.MavenArchiver;
+import org.apache.maven.archiver.MavenArchiveConfiguration;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+
+import java.io.File;
+
+/**
+ * @author <a href="[EMAIL PROTECTED]">Brett Porter</a>
+ * @version $Id$
+ * @goal package
+ */
+public class PackagingMojo
+ extends AbstractMojo
+{
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ */
+ private MavenProject project;
+
+ /**
+ * @parameter expression="${project.build.finalName}"
+ * @required
+ */
+ private String finalName;
+
+ /**
+ * @parameter expression="${project.build.directory}"
+ * @required
+ * @readonly
+ */
+ private String outputDirectory;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ File jarFile = new File( outputDirectory, finalName + "-it.jar" );
+
+ MavenArchiver archiver = new MavenArchiver();
+
+ archiver.setArchiver( new JarArchiver() );
+
+ archiver.setOutputFile( jarFile );
+
+ try
+ {
+ archiver.createArchive( project, new MavenArchiveConfiguration() );
+ }
+ catch ( Exception e )
+ {
+ // TODO: improve error handling
+ throw new MojoExecutionException( "Error assembling JAR", e );
+ }
+
+ project.getArtifact().setFile( jarFile );
+ }
+
+}
+
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/PackagingMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ParameterImplementationMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ParameterImplementationMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ParameterImplementationMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ParameterImplementationMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,42 @@
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Check that we correctly use the implementation parameter. See MNG-2293
+ *
+ * @goal param-implementation
+ * @description Prints out the name of the implementation of the bla field.
+ */
+public class ParameterImplementationMojo
+ extends AbstractMojo
+{
+
+ /**
+ * @parameter implementation="org.apache.maven.plugin.coreit.sub.MyBla"
+ * @required
+ */
+ private Bla bla;
+
+ /**
+ * The expected value of bla.toString().
+ *
+ * @parameter
+ * @required
+ */
+ private String expected;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+
+ getLog().info( "bla: " + bla );
+
+ if ( ! expected.equals( bla.toString() ) )
+ {
+ throw new MojoExecutionException( "Expected '" + expected + "';
found '" + bla + "'" );
+ }
+ }
+
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ParameterImplementationMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ParameterImplementationMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ReachableMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ReachableMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ReachableMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ReachableMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,54 @@
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoFailureException;
+
+import java.net.URL;
+
+/**
+ * @goal reachable
+ * @requiresDependencyResolution test
+ */
+public class ReachableMojo extends AbstractMojo
+{
+ /**
+ * @parameter
+ * @required
+ */
+ private String resource;
+
+ public void execute()
+ throws MojoFailureException
+ {
+ if ( !reach( true ) || !reach( false ) )
+ {
+ throw new MojoFailureException( this, "Resource reachability test
failed..", "Failed to reach resource: " + resource + " using one or more
methods." );
+ }
+ }
+
+ public boolean reach( boolean useContextClassloader ) throws
MojoFailureException
+ {
+ ClassLoader cl;
+ if ( useContextClassloader )
+ {
+ cl = Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ cl = this.getClass().getClassLoader();
+ }
+
+ URL result = cl.getResource( resource );
+
+ getLog().info( "Attepting to reach: " + resource + " from: " + cl +
(useContextClassloader ? " (context classloader)" : "" ) + ( result == null ?
": FAILED" : ":SUCCEEDED" ) );
+
+ if ( result == null )
+ {
+ getLog().info( "Cannot find resource: " + resource +
(useContextClassloader?" in context classloader":"") );
+
+ return false;
+ }
+
+ return true;
+ }
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ReachableMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ReachableMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/RunnableMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/RunnableMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/RunnableMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/RunnableMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,39 @@
+package org.apache.maven.plugin.coreit;
+
+import bsh.EvalError;
+import bsh.Interpreter;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @goal runnable
+ * @requiresDependencyResolution test
+ */
+public class RunnableMojo
+ extends AbstractMojo
+{
+ /**
+ * @parameter
+ * @required
+ */
+ private String script;
+
+ public void execute() throws MojoExecutionException
+ {
+ Interpreter terp = new Interpreter();
+
+ try
+ {
+ getLog().info( "Executing in java version: " + System.getProperty(
"java.version" ) );
+
+ Object result = terp.eval( script );
+
+ getLog().info( "Result of script evaluation was: " + result +
"\nLoaded from: " + result.getClass().getClassLoader() );
+ }
+ catch ( EvalError e )
+ {
+ throw new MojoExecutionException( "Failed to evaluate script.", e
);
+ }
+ }
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/RunnableMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/RunnableMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ThrowMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ThrowMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ThrowMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ThrowMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,39 @@
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * "Throw" a parameter into the plugin context, for the "catch" mojo to
+ * pickup and process.
+ *
+ * @goal throw
+ */
+public class ThrowMojo
+ extends AbstractMojo
+{
+
+ public static final String THROWN_PARAMETER = "throw-parameter";
+
+ /**
+ * @parameter expression="${value}" default-value="thrown"
+ */
+ private String value;
+
+ public void setValue( String value )
+ {
+ this.value = value;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ getPluginContext().put( THROWN_PARAMETER, value );
+ }
+
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ThrowMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/ThrowMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Added:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/TrickyParameterMojo.java
URL:
http://svn.apache.org/viewvc/maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/TrickyParameterMojo.java?view=auto&rev=466576
==============================================================================
---
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/TrickyParameterMojo.java
(added)
+++
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/TrickyParameterMojo.java
Sat Oct 21 14:49:40 2006
@@ -0,0 +1,39 @@
+package org.apache.maven.plugin.coreit;
+
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * Check that tricky things having to do with parameter injection are handled
correctly,
+ * by using the tricky params here!
+ *
+ * @goal tricky-params
+ */
+public class TrickyParameterMojo
+ extends AbstractMojo
+{
+
+ /**
+ * @parameter
expression="${project.distributionManagementArtifactRepository}"
+ * @required
+ * @readonly
+ */
+ private ArtifactRepository deploymentRepo;
+
+ /**
+ * @parameter expression="${requiredParam}"
+ * @required
+ */
+ private String requiredParam;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+
+ getLog().info( "Id of repository: " + deploymentRepo.getId() );
+ getLog().info( "requiredParam: " + requiredParam );
+
+ }
+
+}
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/TrickyParameterMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/sandbox/maven-it/maven-it-plugins/maven-it-plugin-generate-properties/src/main/java/org/apache/maven/plugin/coreit/TrickyParameterMojo.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"