o update the plugin descriptors for changes made in maven to support 4

flavours of POJOs people might try to integrate into Maven.

  CompilerPlugin is now an "integrated" plugin where any amount of
  arbitrary information can go into the execution and come out. In this
  case the compiler plugin can send back detailed compilation errors for
  use in something like and IDE.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@162614 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2004-03-19 04:11:11 +00:00
parent e8bccead0d
commit c9fbf52230
8 changed files with 52 additions and 97 deletions

View File

@ -53,6 +53,11 @@
<artifactId>plexus-compiler</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>maven</groupId>
<artifactId>maven-core</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>

View File

@ -3,10 +3,10 @@ package org.apache.maven.plugin;
import org.codehaus.plexus.compiler.Compiler;
import org.codehaus.plexus.compiler.CompilerError;
import java.io.File;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Iterator;
import java.io.File;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@ -22,28 +22,29 @@ import java.io.File;
// How to accurately report failures to users
public class CompilerPlugin
extends AbstractPlugin
{
private Map compilers;
private String sourceDirectory;
private String outputDirectory;
private String[] classpathElements;
private String compiler;
private boolean debug = true;
public void execute()
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
throws Exception
{
String sourceDirectory = (String) request.getParameter( "sourceDirectory" );
String outputDirectory = (String) request.getParameter( "outputDirectory" );
String[] classpathElements = (String[]) request.getParameter( "classpathElements" );
String compilerId = (String) request.getParameter( "compiler" );
if ( ! new File( sourceDirectory ).exists() )
{
throw new Exception( "The specified source directory '"+ sourceDirectory + "' does not exist!" );
}
Compiler compiler = (Compiler) compilers.get( this.compiler );
Compiler compiler = (Compiler) compilers.get( compilerId );
List messages = compiler.compile( classpathElements, new String[]{sourceDirectory}, outputDirectory );

View File

@ -1,7 +1,7 @@
<plugin>
<id>compiler</id>
<implementation>org.apache.maven.plugin.CompilerPlugin</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
<mode>integrated</mode>
<requirements>
<requirement>
<role>org.codehaus.plexus.compiler.Compiler</role>
@ -11,24 +11,24 @@
<goals>
<goal>
<name>compile</name>
<configuration>
<parameters>
<sourceDirectory>#project.build.sourceDirectory</sourceDirectory>
<outputDirectory>#maven.build.dest</outputDirectory>
<classpathElements>#project.classpathElements</classpathElements>
<compiler>javac</compiler>
</configuration>
</parameters>
</goal>
<goal>
<name>test:compile</name>
<prereqs>
<prereq>compile</prereq>
</prereqs>
<configuration>
<parameters>
<sourceDirectory>#project.build.unitTestSourceDirectory</sourceDirectory>
<outputDirectory>#maven.test.dest</outputDirectory>
<classpathElements>#project.classpathElements</classpathElements>
<compiler>javac</compiler>
</configuration>
</parameters>
</goal>
</goals>
</plugin>

View File

@ -1,6 +1,7 @@
<plugin>
<id>jar</id>
<implementation>org.apache.maven.plugin.JarPlugin</implementation>
<mode>field</mode>
<goals>
<goal>
<name>jar</name>
@ -8,11 +9,11 @@
<prereq>test</prereq>
<prereq>resources</prereq>
</prereqs>
<configuration>
<fields>
<jarName>#maven.final.name</jarName>
<outputDirectory>#maven.build.dir</outputDirectory>
<basedir>#maven.build.dest</basedir>
</configuration>
</fields>
</goal>
</goals>
</plugin>

View File

@ -1,20 +1,21 @@
<plugin>
<id>resource-copier</id>
<implementation>org.apache.maven.plugin.ResourcesPlugin</implementation>
<mode>field</mode>
<goals>
<goal>
<name>resources</name>
<configuration>
<fields>
<outputDirectory>#maven.build.dest</outputDirectory>
<resources>#project.build.resources</resources>
</configuration>
</fields>
</goal>
<goal>
<name>test:resources</name>
<configuration>
<fields>
<outputDirectory>#maven.test.dest</outputDirectory>
<resources>#project.build.unitTest.resources</resources>
</configuration>
</fields>
</goal>
</goals>
</plugin>

View File

@ -41,6 +41,12 @@
<!-- Plexus -->
<dependency>
<groupId>maven</groupId>
<artifactId>maven-core</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>

View File

@ -11,20 +11,13 @@ import java.util.List;
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
*
* @version $Id$
*
* @todo make version of junit and surefire configurable
* @todo make report to be produced configurable
*/
public class SurefirePlugin
{
private String mavenRepoLocal;
private String basedir;
private List includes;
private List excludes;
private String[] classpathElements;
public void execute()
public void execute( String mavenRepoLocal, String basedir, List includes, List excludes, String[] classpathElements )
throws Exception
{
System.setProperty( "basedir", basedir );

View File

@ -1,62 +1,7 @@
<!--
This here is a clear example of some nastiness that has crept into Maven and here
is where it will be cleaned up. This plugin is specific to running tests with
surefire but it may well be a test runner for something else requiring a
different set of resources. The surefire plugin's concern is to run surefire
tests and to do that it must:
o compile the test sources
o copy over the test resources
o run sure fire
So currently below there are prereqs for the test:compile and test:resources
but it is entirely unclear what those things are doing without looking
at the other plugins which is not scalable. If surefire needed to add
foo.jar and bar.jar to the classpath for compiling there would be some
serious nastiness going on in order to modify the parameters of the compile.
So, the surefire plugin should use the other plugins to satisfy its requirements
and by using the plugins directly it can control their use for the specific
purpose of running surefire tests.
A goal is essentially a sequence of plugin executions that have been parameterized for
a specific task.
<plugin>
<id>compiler</id>
<configuration>
<sourceDirectory>#project.build.unitTestSourceDirectory</sourceDirectory>
<outputDirectory>#maven.test.dest</outputDirectory>
<classpathElements>#project.classpathElements</classpathElements>
<compiler>javac</compiler>
</configuration>
</plugin>
<plugin>
<id>resource-copier</id>
<configuration>
<outputDirectory>#maven.test.dest</outputDirectory>
<resources>#project.build.unitTest.resources</resources>
</configuration>
</plugin>
<plugin>
<id>surefire</id>
<configuration>
<mavenRepoLocal>#maven.repo.local</mavenRepoLocal>
<basedir>#basedir</basedir>
<includes>#project.build.unitTest.includes</includes>
<excludes>#project.build.unitTest.excludes</excludes>
<classpathElements>#project.classpathElements</classpathElements>
</configuration>
</plugin>
If say for example you used DbUnit or XMLUnit then the configurations for
each of the plugin executions would be different.
-->
<plugin>
<id>surefire</id>
<implementation>org.apache.maven.test.SurefirePlugin</implementation>
<mode>singleton</mode>
<goals>
<goal>
<name>test</name>
@ -65,13 +10,16 @@ each of the plugin executions would be different.
<prereq>resources</prereq>
<prereq>test:resources</prereq>
</prereqs>
<configuration>
<mavenRepoLocal>#maven.repo.local</mavenRepoLocal>
<basedir>#basedir</basedir>
<includes>#project.build.unitTest.includes</includes>
<excludes>#project.build.unitTest.excludes</excludes>
<classpathElements>#project.classpathElements</classpathElements>
</configuration>
<method>
<name>execute</name>
<parameters>
<mavenRepoLocal>#maven.repo.local</mavenRepoLocal>
<basedir>#basedir</basedir>
<includes>#project.build.unitTest.includes</includes>
<excludes>#project.build.unitTest.excludes</excludes>
<classpathElements>#project.classpathElements</classpathElements>
</parameters>
</method>
</goal>
</goals>
</plugin>