o now fully decoupled and the ITs are using the decouple IT plugins now

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@467117 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2006-10-23 20:14:18 +00:00
parent e38c550233
commit d13fdfa964
20 changed files with 0 additions and 1215 deletions

View File

@ -1,64 +0,0 @@
<?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>2-SNAPSHOT</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.1-SNAPSHOT</version>
<inceptionYear>2001</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>

View File

@ -1,7 +0,0 @@
package org.apache.maven.plugin.coreit;
/**
*/
public interface Bla
{
}

View File

@ -1,78 +0,0 @@
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 )
{
}
}
}
}
}

View File

@ -1,54 +0,0 @@
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" );
}
}
}

View File

@ -1,54 +0,0 @@
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" );
}
}
}

View File

@ -1,151 +0,0 @@
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 );
}
}
}

View File

@ -1,113 +0,0 @@
/*
* 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 );
}
}
}

View File

@ -1,52 +0,0 @@
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 );
}
}
}

View File

@ -1,65 +0,0 @@
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 );
}
}
}

View File

@ -1,59 +0,0 @@
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;
}
}
}

View File

@ -1,143 +0,0 @@
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 );
}
}
}

View File

@ -1,81 +0,0 @@
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="brett@apache.org">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 );
}
}

View File

@ -1,42 +0,0 @@
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 + "'" );
}
}
}

View File

@ -1,54 +0,0 @@
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;
}
}

View File

@ -1,39 +0,0 @@
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 );
}
}
}

View File

@ -1,39 +0,0 @@
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 );
}
}

View File

@ -1,39 +0,0 @@
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 );
}
}

View File

@ -1,26 +0,0 @@
package org.apache.maven.plugin.coreit.sub;
import org.apache.maven.plugin.coreit.Bla;
/**
*/
public class MyBla
implements Bla
{
private String field;
public String getField()
{
return field;
}
public void setField( String field )
{
this.field = field;
}
public String toString()
{
return getClass() + "-" + field;
}
}

View File

@ -1,28 +0,0 @@
<lifecycles>
<lifecycle>
<id>foo</id>
<phases>
<phase>
<id>generate-sources</id>
<executions>
<execution>
<configuration>
<outputDirectory>${project.build.directory}/forked</outputDirectory>
</configuration>
<goals>
<goal>touch</goal>
</goals>
</execution>
<execution>
<configuration>
<outputDirectory>${project.build.directory}/forked2</outputDirectory>
</configuration>
<goals>
<goal>touch</goal>
</goals>
</execution>
</executions>
</phase>
</phases>
</lifecycle>
</lifecycles>

View File

@ -1,27 +0,0 @@
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>coreit-packaging</role-hint>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<configuration>
<phases>
<package>org.apache.maven.plugins:maven-core-it-plugin:package</package>
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
</phases>
</configuration>
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>coreit-artifact</role-hint>
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
<configuration>
<type>coreit-artifact</type>
<extension>jar</extension>
<packaging>coreit-packaging</packaging>
<classifier>it</classifier>
</configuration>
</component>
</components>
</component-set>