You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2009/01/28 01:00:32 UTC
svn commit: r738307 - in /maven/plugins/trunk/maven-invoker-plugin: ./
src/main/java/org/apache/maven/plugin/invoker/ src/main/mdo/
src/test/java/org/apache/maven/plugin/invoker/
Author: olamy
Date: Wed Jan 28 00:00:32 2009
New Revision: 738307
URL: http://svn.apache.org/viewvc?rev=738307&view=rev
Log:
[MINVOKER-76] Have invoker:run generate report files to allow reporting on the results of running invoker
Submitted by Stephen Connolly
Added:
maven/plugins/trunk/maven-invoker-plugin/src/main/mdo/
maven/plugins/trunk/maven-invoker-plugin/src/main/mdo/invocation.mdo (with props)
Modified:
maven/plugins/trunk/maven-invoker-plugin/pom.xml
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/BuildFailureException.java
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
maven/plugins/trunk/maven-invoker-plugin/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java
Modified: maven/plugins/trunk/maven-invoker-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/pom.xml?rev=738307&r1=738306&r2=738307&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-invoker-plugin/pom.xml Wed Jan 28 00:00:32 2009
@@ -139,6 +139,34 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.modello</groupId>
+ <artifactId>modello-maven-plugin</artifactId>
+ <version>1.0-alpha-18</version>
+ <executions>
+ <execution>
+ <goals>
+ <!-- Generate the xpp3 reader code -->
+ <goal>xpp3-reader</goal>
+ <!-- Generate the xpp3 writer code -->
+ <goal>xpp3-writer</goal>
+ <!-- Generate the Java sources for the model itself -->
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <models>
+ <model>src/main/mdo/invocation.mdo</model>
+ </models>
+ <version>1.0.0</version>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
<profiles>
<profile>
Modified: maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/BuildFailureException.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/BuildFailureException.java?rev=738307&r1=738306&r2=738307&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/BuildFailureException.java (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/BuildFailureException.java Wed Jan 28 00:00:32 2009
@@ -1,5 +1,7 @@
package org.apache.maven.plugin.invoker;
+import org.apache.maven.plugin.invoker.model.Invocation;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -33,16 +35,41 @@
/**
* The serial version identifier for this class.
*/
- private static final long serialVersionUID = 236131530635863814L;
+ private static final long serialVersionUID = 236131530635863815L;
+
+ private final String type;
/**
* Creates a new exception with the specified detail message.
- *
+ *
* @param message The detail message, may be <code>null</code>.
*/
public BuildFailureException( String message )
{
super( message );
+ type = Invocation.FAILURE_BUILD_RESULT;
+ }
+
+ /**
+ * Creates a new exception with the specified detail message.
+ *
+ * @param message The detail message, may be <code>null</code>.
+ * @param type The type of build failure, may not be <code>null</code>.
+ */
+ public BuildFailureException( String message, String type )
+ {
+ super( message );
+ type.getClass(); // throw NPE if null.
+ this.type = type;
}
+ /**
+ * Returns the type of build failure.
+ *
+ * @return The type of build failure.
+ */
+ public String getType()
+ {
+ return type;
+ }
}
Modified: maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java?rev=738307&r1=738306&r2=738307&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java Wed Jan 28 00:00:32 2009
@@ -22,8 +22,10 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.Reader;
import java.io.Writer;
@@ -49,6 +51,8 @@
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.invoker.model.Invocation;
+import org.apache.maven.plugin.invoker.model.io.xpp3.InvocationXpp3Writer;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Settings;
import org.apache.maven.shared.invoker.CommandLineConfigurationException;
@@ -58,6 +62,10 @@
import org.apache.maven.shared.invoker.Invoker;
import org.apache.maven.shared.invoker.MavenCommandLineBuilder;
import org.apache.maven.shared.invoker.MavenInvocationException;
+import org.codehaus.plexus.interpolation.InterpolationException;
+import org.codehaus.plexus.interpolation.Interpolator;
+import org.codehaus.plexus.interpolation.MapBasedValueSource;
+import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
@@ -65,10 +73,6 @@
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.WriterFactory;
-import org.codehaus.plexus.interpolation.InterpolationException;
-import org.codehaus.plexus.interpolation.Interpolator;
-import org.codehaus.plexus.interpolation.MapBasedValueSource;
-import org.codehaus.plexus.interpolation.RegexBasedInterpolator;
/**
* Searches for integration test Maven projects, and executes each, collecting a log in the project directory, and
@@ -129,6 +133,13 @@
private File projectsDirectory;
/**
+ * Base directory where all reports are written to.
+ *
+ * @parameter expression="${project.build.directory}/invoker-reports"
+ */
+ private File reportsDirectory;
+
+ /**
* Directory to which projects should be cloned prior to execution. If not specified, each integration test will be
* run in the directory in which the corresponding IT POM was found. In this case, you most likely want to configure
* your SCM to ignore <code>target</code> and <code>build.log</code> in the test's base directory.
@@ -501,7 +512,8 @@
return;
}
- String[] includedPoms;
+ reportsDirectory.mkdirs();
+ Invocation[] includedPoms;
if ( pom != null )
{
try
@@ -514,7 +526,7 @@
+ " Reason: " + e.getMessage(), e );
}
- includedPoms = new String[]{ pom.getName() };
+ includedPoms = new Invocation[]{ newInvocation( pom.getName(), Invocation.NORMAL_TYPE )};
}
else
{
@@ -550,7 +562,7 @@
Collection collectedProjects = new LinkedHashSet();
for ( int i = 0; i < includedPoms.length; i++ )
{
- collectProjects( projectsDirectory, includedPoms[i], collectedProjects, true );
+ collectProjects( projectsDirectory, includedPoms[i].getProject(), collectedProjects, true );
}
File projectsDir = projectsDirectory;
@@ -589,7 +601,12 @@
for ( final Iterator it = failures.iterator(); it.hasNext(); )
{
- String item = "* " + (String) it.next();
+ Invocation invocation = (Invocation) it.next();
+ String item = "* " + invocation.getProject();
+ if ( invocation.getFailureMessage() != null )
+ {
+ item += " (" + invocation.getFailureMessage() + ")";
+ }
if ( ignoreFailures )
{
getLog().warn( item );
@@ -619,6 +636,14 @@
}
}
+ private Invocation newInvocation( String project, String type )
+ {
+ Invocation included = new Invocation();
+ included.setProject( project );
+ included.setType( type );
+ return included;
+ }
+
/**
* Creates a new reader for the specified file, using the plugin's {@link #encoding} parameter.
*
@@ -918,12 +943,12 @@
* Runs the specified projects.
*
* @param projectsDir The base directory of all projects, must not be <code>null</code>.
- * @param projects The relative paths to the projects, either to their POM file or merely to their base directory,
+ * @param invocations The relative paths to the projects, either to their POM file or merely to their base directory,
* must not be <code>null</code> nor contain <code>null</code> elements.
* @return The list of projects that failed, can be empty but never <code>null</code>.
* @throws MojoExecutionException If any project could not be launched.
*/
- private List runBuilds( File projectsDir, String[] projects )
+ private List runBuilds( File projectsDir, Invocation[] invocations )
throws MojoExecutionException
{
List failures = new ArrayList();
@@ -950,9 +975,9 @@
try
{
- for ( int i = 0; i < projects.length; i++ )
+ for ( int i = 0; i < invocations.length; i++ )
{
- String project = projects[i];
+ Invocation project = invocations[i];
try
{
runBuild( projectsDir, project, interpolatedSettingsFile );
@@ -978,17 +1003,17 @@
* Runs the specified project.
*
* @param projectsDir The base directory of all projects, must not be <code>null</code>.
- * @param project The relative path to the project, either to a POM file or merely to a directory, must not be
+ * @param invocation The relative path to the project, either to a POM file or merely to a directory, must not be
* <code>null</code>.
* @param settingsFile The (already interpolated) user settings file for the build, may be <code>null</code> to use
* the current user settings.
* @throws MojoExecutionException If the project could not be launched.
* @throws BuildFailureException If either a hook script or the build itself failed.
*/
- private void runBuild( File projectsDir, String project, File settingsFile )
+ private void runBuild( File projectsDir, Invocation invocation, File settingsFile )
throws MojoExecutionException, BuildFailureException
{
- File pomFile = new File( projectsDir, project );
+ File pomFile = new File( projectsDir, invocation.getProject() );
File basedir;
if ( pomFile.isDirectory() )
{
@@ -1000,7 +1025,7 @@
}
else
{
- project += File.separator + "pom.xml";
+ invocation.setProject( invocation.getProject() + File.separator + "pom.xml" );
}
}
else
@@ -1008,7 +1033,7 @@
basedir = pomFile.getParentFile();
}
- getLog().info( "Building: " + project );
+ getLog().info( "Building: " + invocation.getProject() );
File interpolatedPomFile = null;
if ( pomFile != null )
@@ -1024,22 +1049,35 @@
}
}
+ InvokerProperties invokerProperties = getInvokerProperties( basedir );
+
+ // let's set what details we can
+ invocation.setName( invokerProperties.getProperties().getProperty( "invoker.name" ) );
+ invocation.setDescription( invokerProperties.getProperties().getProperty( "invoker.description" ) );
+
long milliseconds = System.currentTimeMillis();
try
{
- runBuild( basedir, interpolatedPomFile, settingsFile );
+ runBuild( basedir, interpolatedPomFile, settingsFile, invokerProperties );
+
+ milliseconds = System.currentTimeMillis() - milliseconds;
+ invocation.setResult( Invocation.SUCCESS_RESULT );
+ invocation.setTime( milliseconds / 1000.0 );
if ( !suppressSummaries )
{
- milliseconds = System.currentTimeMillis() - milliseconds;
getLog().info( "..SUCCESS " + formatTime( milliseconds ) );
}
}
catch ( BuildFailureException e )
{
+ milliseconds = System.currentTimeMillis() - milliseconds;
+ invocation.setResult( Invocation.FAILURE_BUILD_RESULT );
+ invocation.setFailureMessage( e.getMessage() );
+ invocation.setTime( milliseconds / 1000.0 );
+
if ( !suppressSummaries )
{
- milliseconds = System.currentTimeMillis() - milliseconds;
getLog().info( "..FAILED " + formatTime( milliseconds ) );
getLog().info( " " + e.getMessage() );
}
@@ -1051,6 +1089,33 @@
{
interpolatedPomFile.delete();
}
+ // now write the invocation summary
+
+ String safeFileName = invocation.getProject().replace( '/', '_' ).replace( '\\', '_' ).replace( ' ', '_' );
+ if ( safeFileName.endsWith( "_pom.xml" ) )
+ {
+ safeFileName = safeFileName.substring( 0, safeFileName.length() - "_pom.xml".length() );
+ }
+ File reportFile = new File( reportsDirectory, "INVOCATION-" + safeFileName + ".xml" );
+ try
+ {
+ FileOutputStream fos = new FileOutputStream( reportFile );
+ try
+ {
+ OutputStreamWriter osw = new OutputStreamWriter( fos, invocation.getModelEncoding() );
+ InvocationXpp3Writer writer = new InvocationXpp3Writer();
+ writer.write( osw, invocation );
+ osw.close();
+ }
+ finally
+ {
+ fos.close();
+ }
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( e.getMessage(), e );
+ }
}
}
@@ -1072,13 +1137,13 @@
* @param pomFile The (already interpolated) POM file, may be <code>null</code> for a POM-less Maven invocation.
* @param settingsFile The (already interpolated) user settings file for the build, may be <code>null</code> to use
* the current user settings.
+ * @param invokerProperties The properties to use.
* @throws MojoExecutionException If the project could not be launched.
* @throws BuildFailureException If either a hook script or the build itself failed.
*/
- private void runBuild( File basedir, File pomFile, File settingsFile )
+ private void runBuild( File basedir, File pomFile, File settingsFile, InvokerProperties invokerProperties )
throws MojoExecutionException, BuildFailureException
{
- InvokerProperties invokerProperties = getInvokerProperties( basedir );
if ( getLog().isDebugEnabled() && !invokerProperties.getProperties().isEmpty() )
{
Properties props = invokerProperties.getProperties();
@@ -1102,7 +1167,8 @@
FileLogger logger = setupLogger( basedir );
try
{
- runScript( "pre-build script", basedir, preBuildHookScript, context, logger );
+ runScript( "pre-build script", basedir, preBuildHookScript, context, logger,
+ Invocation.FAILURE_PRE_HOOK_RESULT );
final InvocationRequest request = new DefaultInvocationRequest();
@@ -1182,7 +1248,8 @@
verify( result, invocationIndex, invokerProperties, logger );
}
- runScript( "post-build script", basedir, postBuildHookScript, context, logger );
+ runScript( "post-build script", basedir, postBuildHookScript, context, logger,
+ Invocation.FAILURE_POST_HOOK_RESULT );
}
finally
{
@@ -1298,7 +1365,7 @@
if ( result.getExecutionException() != null )
{
throw new BuildFailureException( "The Maven invocation failed. "
- + result.getExecutionException().getMessage() );
+ + result.getExecutionException().getMessage(), Invocation.ERROR_RESULT );
}
else if ( !invokerProperties.isExpectedResult( result.getExitCode(), invocationIndex ) )
{
@@ -1314,7 +1381,7 @@
{
buffer.append( "See console output for details." );
}
- throw new BuildFailureException( buffer.toString() );
+ throw new BuildFailureException( buffer.toString(), Invocation.FAILURE_BUILD_RESULT );
}
}
@@ -1327,11 +1394,12 @@
* to skip the script execution.
* @param context The key-value storage used to share information between hook scripts, may be <code>null</code>.
* @param logger The logger to redirect the script output to, may be <code>null</code> to use stdout/stderr.
+ * @param stage
* @throws MojoExecutionException If an I/O error occurred while reading the script file.
* @throws BuildFailureException If the script did not return <code>true</code> of threw an exception.
*/
private void runScript( final String scriptDescription, final File basedir, final String relativeScriptPath,
- final Map context, final FileLogger logger )
+ final Map context, final FileLogger logger, String stage )
throws MojoExecutionException, BuildFailureException
{
if ( relativeScriptPath == null )
@@ -1401,12 +1469,12 @@
{
t.printStackTrace( logger.getPrintStream() );
}
- throw new BuildFailureException( "The " + scriptDescription + " did not succeed. " + msg );
+ throw new BuildFailureException( "The " + scriptDescription + " did not succeed. " + msg, stage );
}
if ( !( Boolean.TRUE.equals( result ) || "true".equals( result ) ) )
{
- throw new BuildFailureException( "The " + scriptDescription + " returned " + result + "." );
+ throw new BuildFailureException( "The " + scriptDescription + " returned " + result + ".", stage );
}
}
@@ -1502,14 +1570,14 @@
* @return The paths to the projects that should be build, may be empty but never <code>null</code>.
* @throws IOException If the projects directory could not be scanned.
*/
- String[] getPoms()
+ Invocation[] getPoms()
throws IOException
{
- String[] poms;
+ Invocation[] poms;
if ( ( pom != null ) && pom.exists() )
{
- poms = new String[] { pom.getAbsolutePath() };
+ poms = new Invocation[] { newInvocation( pom.getAbsolutePath(), Invocation.NORMAL_TYPE ) };
}
else if ( invokerTest != null )
{
@@ -1522,7 +1590,9 @@
includes.add( testRegexes[i] );
}
- poms = scanProjectsDirectory( includes, null );
+ // it would be nice if we could figure out what types these are... but perhaps
+ // not necessary for the -Dinvoker.test=xxx t
+ poms = scanProjectsDirectory( includes, null, Invocation.DIRECT_TYPE );
}
else
{
@@ -1537,15 +1607,25 @@
}
}
- String[] setupPoms = scanProjectsDirectory( setupIncludes, excludes );
+ Invocation[] setupPoms = scanProjectsDirectory( setupIncludes, excludes, Invocation.SETUP_TYPE );
getLog().debug( "Setup projects: " + Arrays.asList( setupPoms ) );
- String[] normalPoms = scanProjectsDirectory( pomIncludes, excludes );
+ Invocation[] normalPoms = scanProjectsDirectory( pomIncludes, excludes, Invocation.NORMAL_TYPE );
+
+ Map uniquePoms = new LinkedHashMap();
+ for ( int i = 0; i < setupPoms.length; i++ )
+ {
+ uniquePoms.put( setupPoms[i].getProject(), setupPoms[i] );
+ }
+ for ( int i = 0; i < normalPoms.length; i++ )
+ {
+ if ( !uniquePoms.containsKey( normalPoms[i].getProject() ) )
+ {
+ uniquePoms.put( normalPoms[i].getProject(), normalPoms[i] );
+ }
+ }
- Collection uniquePoms = new LinkedHashSet();
- uniquePoms.addAll( Arrays.asList( setupPoms ) );
- uniquePoms.addAll( Arrays.asList( normalPoms ) );
- poms = (String[]) uniquePoms.toArray( new String[uniquePoms.size()] );
+ poms = (Invocation[]) uniquePoms.values().toArray( new Invocation[uniquePoms.size()] );
}
poms = relativizeProjectPaths( poms );
@@ -1564,12 +1644,12 @@
* @return The relative paths to either POM files or project base directories, never <code>null</code>.
* @throws IOException If the project directory could not be scanned.
*/
- private String[] scanProjectsDirectory( List includes, List excludes )
+ private Invocation[] scanProjectsDirectory( List includes, List excludes, String type )
throws IOException
{
if ( !projectsDirectory.isDirectory() )
{
- return new String[0];
+ return new Invocation[0];
}
DirectoryScanner scanner = new DirectoryScanner();
@@ -1586,9 +1666,13 @@
scanner.addDefaultExcludes();
scanner.scan();
- Collection matches = new LinkedHashSet();
+ Map matches = new LinkedHashMap();
- matches.addAll( Arrays.asList( scanner.getIncludedFiles() ) );
+ String[] includedFiles = scanner.getIncludedFiles();
+ for ( int i = 0; i < includedFiles.length; i++ )
+ {
+ matches.put( includedFiles[i], newInvocation( includedFiles[i], type ) );
+ }
String[] includedDirs = scanner.getIncludedDirectories();
for ( int i = 0; i < includedDirs.length; i++ )
@@ -1596,36 +1680,36 @@
String includedFile = includedDirs[i] + File.separatorChar + "pom.xml";
if ( new File( scanner.getBasedir(), includedFile ).isFile() )
{
- matches.add( includedFile );
+ matches.put( includedFile, newInvocation( includedFile, type ) );
}
else
{
- matches.add( includedDirs[i] );
+ matches.put( includedDirs[i], newInvocation( includedDirs[i], type ) );
}
}
- return (String[]) matches.toArray( new String[matches.size()] );
+ return (Invocation[]) matches.values().toArray( new Invocation[matches.size()] );
}
/**
* Relativizes the specified project paths against the directory specified by {@link #projectsDirectory} (if
* possible). If a project path does not denote a sub path of the projects directory, it is returned as is.
*
- * @param projectPaths The project paths to relativize, must not be <code>null</code> nor contain <code>null</code>
+ * @param invocations The projects to relativize the paths of, must not be <code>null</code> nor contain <code>null</code>
* elements.
- * @return The relativized project paths, never <code>null</code>.
+ * @return The relativized projects, never <code>null</code>.
* @throws IOException If any path could not be relativized.
*/
- private String[] relativizeProjectPaths( String[] projectPaths )
+ private Invocation[] relativizeProjectPaths( Invocation[] invocations )
throws IOException
{
String projectsDirPath = projectsDirectory.getCanonicalPath();
- String[] results = new String[projectPaths.length];
+ Invocation[] results = new Invocation[invocations.length];
- for ( int i = 0; i < projectPaths.length; i++ )
+ for ( int i = 0; i < invocations.length; i++ )
{
- String projectPath = projectPaths[i];
+ String projectPath = invocations[i].getProject();
File file = new File( projectPath );
@@ -1641,7 +1725,9 @@
relativizedPath = projectPath;
}
- results[i] = relativizedPath;
+ results[i] = new Invocation();
+ results[i].setProject( relativizedPath );
+ results[i].setType( invocations[i].getType() );
}
return results;
Added: maven/plugins/trunk/maven-invoker-plugin/src/main/mdo/invocation.mdo
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/mdo/invocation.mdo?rev=738307&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/main/mdo/invocation.mdo (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/main/mdo/invocation.mdo Wed Jan 28 00:00:32 2009
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+
+<model xsd.namespace="http://maven.apache.org/invoker/1.0.0" xsd.target-namespace="http://maven.apache.org/invoker/1.0.0">
+ <id>invocation</id>
+ <name>Invocation</name>
+ <description><![CDATA[An invocation of Maven by maven-invoker-plugin.]]></description>
+ <defaults>
+ <default>
+ <key>package</key>
+ <value>org.apache.maven.plugin.invoker.model</value>
+ </default>
+ </defaults>
+ <versionDefinition>
+ <type>namespace</type>
+ </versionDefinition>
+ <classes>
+ <class rootElement="true" xml.tagName="invocation">
+ <name>Invocation</name>
+ <description>Describes an invocation of Maven by maven-invoker-plugin.</description>
+ <version>1.0.0</version>
+ <fields>
+ <field xml.attribute="true">
+ <name>project</name>
+ <version>1.0.0</version>
+ <required>true</required>
+ <type>String</type>
+ <description>The invoked project.</description>
+ </field>
+ <field xml.attribute="true">
+ <name>name</name>
+ <version>1.0.0</version>
+ <required>false</required>
+ <type>String</type>
+ <description>The name of the invocation.</description>
+ </field>
+ <field>
+ <name>description</name>
+ <version>1.0.0</version>
+ <required>false</required>
+ <type>String</type>
+ <description>The description of the invocation.</description>
+ </field>
+ <field xml.attribute="true">
+ <name>result</name>
+ <version>1.0.0</version>
+ <required>true</required>
+ <type>String</type>
+ <description>The result of the invocation.</description>
+ </field>
+ <field>
+ <name>failureMessage</name>
+ <version>1.0.0</version>
+ <required>false</required>
+ <type>String</type>
+ <description>Any failure message(s) for a failed invocation.</description>
+ </field>
+ <field xml.attribute="true">
+ <name>time</name>
+ <version>1.0.0</version>
+ <required>true</required>
+ <type>double</type>
+ <description>The number of seconds that invocation too to complete.</description>
+ </field>
+ <field xml.attribute="true">
+ <name>type</name>
+ <version>1.0.0</version>
+ <required>true</required>
+ <type>String</type>
+ <description>The type of the invocation.</description>
+ </field>
+ </fields>
+ <codeSegments>
+ <codeSegment>
+ <version>1.0.0+</version>
+ <code><![CDATA[
+ /**
+ * The result value corresponding with a successful invocation of Maven and completion of all post-hook
+ * scripts.
+ */
+ public static final String SUCCESS_RESULT = "success";
+
+ /**
+ * The result value corresponding with an invocation that was skipped.
+ */
+ public static final String SKIPPED_RESULT = "skipped";
+
+ /**
+ * The result value corresponding with an invocation that failed before Maven was be invoked.
+ */
+ public static final String FAILURE_PRE_HOOK_RESULT = "failure-pre-hook";
+
+ /**
+ * The result value corresponding with an unexpected error trying to invoke Maven.
+ */
+ public static final String ERROR_RESULT = "error";
+
+ /**
+ * The result value corresponding with an invocation that failed while invoking of Maven.
+ */
+ public static final String FAILURE_BUILD_RESULT = "failure-build";
+
+ /**
+ * The result value corresponding with an invocation that failed after the invoking of Maven.
+ */
+ public static final String FAILURE_POST_HOOK_RESULT = "failure-post-hook";
+ ]]></code>
+ </codeSegment>
+ <codeSegment>
+ <version>1.0.0+</version>
+ <code><![CDATA[
+ /**
+ * An invocation that should be invoked before any non-setup invocations.
+ */
+ public static final String SETUP_TYPE = "setup";
+
+ /**
+ * A normal invocation.
+ */
+ public static final String NORMAL_TYPE = "normal";
+
+ /**
+ * A direct invocation via the <code>-Dinvoker.test=xxx,yyy</code> parameter.
+ */
+ public static final String DIRECT_TYPE = "direct";
+ ]]></code>
+ </codeSegment>
+ <codeSegment>
+ <version>1.0.0+</version>
+ <code><![CDATA[
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer( "Invocation" );
+ buf.append( "[project = \"" );
+ buf.append( project );
+ buf.append( "\", type = " );
+ buf.append( type );
+ buf.append( ']' );
+ return buf.toString();
+ }
+ ]]></code>
+ </codeSegment>
+ </codeSegments>
+ </class>
+ </classes>
+</model>
\ No newline at end of file
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/main/mdo/invocation.mdo
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-invoker-plugin/src/main/mdo/invocation.mdo
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/plugins/trunk/maven-invoker-plugin/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java?rev=738307&r1=738306&r2=738307&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java Wed Jan 28 00:00:32 2009
@@ -26,6 +26,7 @@
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.apache.maven.plugin.invoker.model.Invocation;
import org.apache.maven.settings.Settings;
/**
@@ -65,7 +66,7 @@
assertEquals( 1, goals.size() );
setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) );
setVariableValueToObject( invokerMojo, "invokerTest", "*dummy*" );
- String[] poms = invokerMojo.getPoms();
+ Invocation[] poms = invokerMojo.getPoms();
System.out.println( Arrays.asList( poms ) );
assertEquals( 1, poms.length );
}
@@ -80,7 +81,7 @@
assertEquals( 1, goals.size() );
setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) );
setVariableValueToObject( invokerMojo, "invokerTest", "*dummy*,*terpolatio*" );
- String[] poms = invokerMojo.getPoms();
+ Invocation[] poms = invokerMojo.getPoms();
System.out.println( Arrays.asList( poms ) );
assertEquals( 2, poms.length );
}
@@ -95,7 +96,7 @@
assertEquals( 1, goals.size() );
setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) );
setVariableValueToObject( invokerMojo, "invokerTest", "*" );
- String[] poms = invokerMojo.getPoms();
+ Invocation[] poms = invokerMojo.getPoms();
System.out.println( Arrays.asList( poms ) );
assertEquals( 4, poms.length );
}