mirror of https://github.com/apache/maven.git
More unit tests, this time for plugin-related error messages.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@612592 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
835488bada
commit
0c61152546
|
@ -5,6 +5,7 @@ import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
|||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
||||
import org.apache.maven.artifact.versioning.VersionRange;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
||||
import org.apache.maven.execution.MavenExecutionRequest;
|
||||
|
@ -29,6 +30,8 @@ import org.apache.maven.plugin.DefaultPluginManager;
|
|||
import org.apache.maven.plugin.version.DefaultPluginVersionManager;
|
||||
import org.apache.maven.realm.RealmManagementException;
|
||||
import org.apache.maven.execution.RuntimeInformation;
|
||||
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
|
||||
import org.apache.maven.artifact.versioning.VersionRange;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
@ -144,12 +147,11 @@ public privileged aspect ExtensionErrorReporterAspect
|
|||
private pointcut within_dpvm_resolveMetaVersion():
|
||||
withincode( * DefaultPluginVersionManager.resolveMetaVersion( .. ) );
|
||||
|
||||
before( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, ArtifactMetadataRetrievalException cause ):
|
||||
after( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request ) throwing ( ArtifactMetadataRetrievalException cause ):
|
||||
cflow( dem_addPluginAsExtension( plugin, originModel, remoteRepos, request ) )
|
||||
&& cflow( execution( * PluginManager+.verifyPlugin( .. ) ) )
|
||||
&& within_dpvm_resolveMetaVersion()
|
||||
&& call( PluginVersionResolutionException.new( .., ArtifactMetadataRetrievalException ) )
|
||||
&& args( .., cause )
|
||||
&& call( * ArtifactMetadataSource+.retrieve( .. ) )
|
||||
{
|
||||
getReporter().reportUnresolvableExtensionPluginPOM( plugin, originModel, remoteRepos, request, cause );
|
||||
}
|
||||
|
@ -174,7 +176,7 @@ public privileged aspect ExtensionErrorReporterAspect
|
|||
}
|
||||
|
||||
after():
|
||||
execution( * DefaultPluginManager.checkRequiredMavenVersion( .. ) )
|
||||
execution( * DefaultPluginManager.verifyVersionedPlugin( .. ) )
|
||||
{
|
||||
requiredVersion = null;
|
||||
currentVersion = null;
|
||||
|
@ -187,12 +189,20 @@ public privileged aspect ExtensionErrorReporterAspect
|
|||
currentVersion = null;
|
||||
}
|
||||
|
||||
before( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, InvalidVersionSpecificationException cause ):
|
||||
after( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request ) throwing ( InvalidVersionSpecificationException cause ):
|
||||
cflow( dem_addPluginAsExtension( plugin, originModel, remoteRepos, request ) )
|
||||
&& cflow( execution( * PluginManager+.verifyPlugin( .. ) ) )
|
||||
&& withincode( * DefaultPluginVersionManager.resolveMetaVersion( .. ) )
|
||||
&& call( PluginVersionResolutionException.new( .., InvalidVersionSpecificationException ) )
|
||||
&& args( .., cause )
|
||||
&& call( VersionRange VersionRange.createFromVersionSpec( .. ) )
|
||||
{
|
||||
getReporter().reportErrorSearchingforCompatibleExtensionPluginVersion( plugin, originModel, remoteRepos, request, requiredVersion, currentVersion, cause );
|
||||
}
|
||||
|
||||
after( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request ) throwing ( ArtifactMetadataRetrievalException cause ):
|
||||
cflow( dem_addPluginAsExtension( plugin, originModel, remoteRepos, request ) )
|
||||
&& cflow( execution( * PluginManager+.verifyPlugin( .. ) ) )
|
||||
&& withincode( * DefaultPluginVersionManager.resolveMetaVersion( .. ) )
|
||||
&& call( * ArtifactMetadataSource+.retrieveAvailableVersions( .. ) )
|
||||
{
|
||||
getReporter().reportErrorSearchingforCompatibleExtensionPluginVersion( plugin, originModel, remoteRepos, request, requiredVersion, currentVersion, cause );
|
||||
}
|
||||
|
@ -201,12 +211,11 @@ public privileged aspect ExtensionErrorReporterAspect
|
|||
execution( * DefaultPluginManager.verifyVersionedPlugin( Plugin, .. ) )
|
||||
&& args( plugin, .. );
|
||||
|
||||
after( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, PluginVersionResolutionException err ):
|
||||
after( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request ) throwing ( PluginVersionResolutionException err ):
|
||||
cflow( dem_addPluginAsExtension( Plugin, originModel, remoteRepos, request ) )
|
||||
&& cflow( execution( * PluginManager+.verifyPlugin( .. ) ) )
|
||||
&& cflow( dpm_verifyVersionedPlugin( plugin ) )
|
||||
&& call( PluginVersionResolutionException.new( .., String ) )
|
||||
&& this( err )
|
||||
&& call( private void DefaultPluginManager.checkRequiredMavenVersion( .. ) )
|
||||
{
|
||||
getReporter().reportIncompatibleMavenVersionForExtensionPlugin( plugin, originModel, remoteRepos, request, requiredVersion, currentVersion, err );
|
||||
}
|
||||
|
|
|
@ -79,6 +79,8 @@ public interface CoreErrorReporter
|
|||
|
||||
void reportErrorSearchingforCompatibleExtensionPluginVersion( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, String requiredMavenVersion, String currentMavenVersion, InvalidVersionSpecificationException cause );
|
||||
|
||||
void reportErrorSearchingforCompatibleExtensionPluginVersion( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, String requiredMavenVersion, String currentMavenVersion, ArtifactMetadataRetrievalException cause );
|
||||
|
||||
void reportExtensionPluginArtifactNotFound( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, PluginNotFoundException cause );
|
||||
|
||||
void reportExtensionPluginVersionNotFound( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, PluginVersionNotFoundException cause );
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
|
|||
import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
|
||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
||||
import org.apache.maven.lifecycle.LifecycleException;
|
||||
import org.apache.maven.lifecycle.model.MojoBinding;
|
||||
import org.apache.maven.model.Model;
|
||||
|
@ -270,7 +269,7 @@ public final class CoreErrorTips
|
|||
Model originModel,
|
||||
String requiredMavenVersion,
|
||||
String currentMavenVersion,
|
||||
InvalidVersionSpecificationException cause )
|
||||
Exception cause )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
|
|
|
@ -1392,6 +1392,51 @@ public class DefaultCoreErrorReporter
|
|||
registerBuildError( cause, writer.toString() );
|
||||
}
|
||||
|
||||
public void reportErrorSearchingforCompatibleExtensionPluginVersion( Plugin plugin,
|
||||
Model originModel,
|
||||
List remoteRepos,
|
||||
MavenExecutionRequest request,
|
||||
String requiredMavenVersion,
|
||||
String currentMavenVersion,
|
||||
ArtifactMetadataRetrievalException cause )
|
||||
{
|
||||
StringWriter writer = new StringWriter();
|
||||
|
||||
writer.write( NEWLINE );
|
||||
writer.write( "Maven encountered an incompatible version of a plugin used by your project as a build extension." );
|
||||
writer.write( " In attempting to search for an older version of this plugin, Maven failed to retrieve the list of available plugin versions." );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( "Project:" );
|
||||
writeProjectCoordinate( originModel, null, writer );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( "Plugin (used as an extension):" );
|
||||
writePluginInfo( plugin, writer );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( NEWLINE );
|
||||
|
||||
writer.write( "Current Maven version: " );
|
||||
writer.write( currentMavenVersion );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( "Plugin requires Maven version: " );
|
||||
writer.write( requiredMavenVersion );
|
||||
|
||||
writer.write( NEWLINE );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( "Error message: " );
|
||||
writer.write( cause.getMessage() );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( NEWLINE );
|
||||
writer.write( "Root error message: " );
|
||||
writer.write( getRootCause( cause ).getMessage() );
|
||||
|
||||
addTips( CoreErrorTips.getInvalidPluginVersionRangeForExtensionPluginTips( plugin, originModel, requiredMavenVersion, currentMavenVersion, cause ),
|
||||
writer );
|
||||
|
||||
registerBuildError( cause, writer.toString() );
|
||||
}
|
||||
|
||||
public void reportIncompatibleMavenVersionForExtensionPlugin( Plugin plugin,
|
||||
Model originModel,
|
||||
List remoteRepos,
|
||||
|
|
|
@ -217,7 +217,11 @@ public class DefaultPluginManager
|
|||
|
||||
remoteRepositories.addAll( project.getRemoteArtifactRepositories() );
|
||||
|
||||
checkRequiredMavenVersion( plugin, localRepository, remoteRepositories );
|
||||
MavenProject pluginProject = buildPluginProject( plugin, localRepository, remoteRepositories );
|
||||
|
||||
checkRequiredMavenVersion( plugin, pluginProject, localRepository, remoteRepositories );
|
||||
|
||||
checkPluginDependencySpec( plugin, pluginProject );
|
||||
|
||||
Artifact pluginArtifact = artifactFactory.createPluginArtifact(
|
||||
plugin.getGroupId(),
|
||||
|
@ -270,38 +274,35 @@ public class DefaultPluginManager
|
|||
return pluginDescriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo would be better to store this in the plugin descriptor, but then it won't be available to the version
|
||||
* manager which executes before the plugin is instantiated
|
||||
*/
|
||||
private void checkRequiredMavenVersion( Plugin plugin,
|
||||
ArtifactRepository localRepository,
|
||||
List remoteRepositories )
|
||||
throws PluginVersionResolutionException, InvalidPluginException
|
||||
private void checkPluginDependencySpec( Plugin plugin,
|
||||
MavenProject pluginProject )
|
||||
throws InvalidPluginException
|
||||
{
|
||||
ArtifactFilter filter = new ScopeArtifactFilter( "runtime" );
|
||||
try
|
||||
{
|
||||
Artifact artifact = artifactFactory.createProjectArtifact( plugin.getGroupId(),
|
||||
plugin.getArtifactId(),
|
||||
plugin.getVersion() );
|
||||
MavenProject project = mavenProjectBuilder.buildFromRepository( artifact,
|
||||
remoteRepositories,
|
||||
localRepository );
|
||||
// if we don't have the required Maven version, then ignore an update
|
||||
if ( ( project.getPrerequisites() != null )
|
||||
&& ( project.getPrerequisites().getMaven() != null ) )
|
||||
{
|
||||
DefaultArtifactVersion requiredVersion = new DefaultArtifactVersion(
|
||||
project.getPrerequisites()
|
||||
.getMaven() );
|
||||
if ( runtimeInformation.getApplicationVersion().compareTo( requiredVersion ) < 0 )
|
||||
{
|
||||
throw new PluginVersionResolutionException( plugin.getGroupId(),
|
||||
plugin.getArtifactId(),
|
||||
"Plugin requires Maven version "
|
||||
+ requiredVersion );
|
||||
}
|
||||
}
|
||||
pluginProject.createArtifacts( artifactFactory, null, filter );
|
||||
}
|
||||
catch ( InvalidDependencyVersionException e )
|
||||
{
|
||||
throw new InvalidPluginException( "Plugin: " + plugin.getKey() + " has a dependency with an invalid version.", e );
|
||||
}
|
||||
}
|
||||
|
||||
private MavenProject buildPluginProject( Plugin plugin,
|
||||
ArtifactRepository localRepository,
|
||||
List remoteRepositories )
|
||||
throws InvalidPluginException
|
||||
{
|
||||
Artifact artifact = artifactFactory.createProjectArtifact( plugin.getGroupId(),
|
||||
plugin.getArtifactId(),
|
||||
plugin.getVersion() );
|
||||
|
||||
try
|
||||
{
|
||||
return mavenProjectBuilder.buildFromRepository( artifact,
|
||||
remoteRepositories,
|
||||
localRepository );
|
||||
}
|
||||
catch ( ProjectBuildingException e )
|
||||
{
|
||||
|
@ -310,6 +311,33 @@ public class DefaultPluginManager
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pluginProject
|
||||
* @todo would be better to store this in the plugin descriptor, but then it won't be available to the version
|
||||
* manager which executes before the plugin is instantiated
|
||||
*/
|
||||
private void checkRequiredMavenVersion( Plugin plugin,
|
||||
MavenProject pluginProject,
|
||||
ArtifactRepository localRepository,
|
||||
List remoteRepositories )
|
||||
throws PluginVersionResolutionException, InvalidPluginException
|
||||
{
|
||||
// if we don't have the required Maven version, then ignore an update
|
||||
if ( ( pluginProject.getPrerequisites() != null )
|
||||
&& ( pluginProject.getPrerequisites().getMaven() != null ) )
|
||||
{
|
||||
DefaultArtifactVersion requiredVersion = new DefaultArtifactVersion( pluginProject.getPrerequisites().getMaven() );
|
||||
|
||||
if ( runtimeInformation.getApplicationVersion().compareTo( requiredVersion ) < 0 )
|
||||
{
|
||||
throw new PluginVersionResolutionException( plugin.getGroupId(),
|
||||
plugin.getArtifactId(),
|
||||
"Plugin requires Maven version "
|
||||
+ requiredVersion );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void addPlugin( Plugin plugin,
|
||||
Artifact pluginArtifact,
|
||||
MavenProject project,
|
||||
|
|
|
@ -202,8 +202,8 @@ public class DefaultPluginVersionManager
|
|||
|
||||
String artifactVersion = artifact.getVersion();
|
||||
|
||||
// make sure this artifact was actually resolved to a file in the repo...
|
||||
if ( artifact.getFile() != null )
|
||||
// make sure this artifact was transformed to a real version, and actually resolved to a file in the repo...
|
||||
if ( !metaVersionId.equals( artifactVersion ) && ( artifact.getFile() != null ) )
|
||||
{
|
||||
boolean pluginValid = false;
|
||||
|
||||
|
@ -229,10 +229,10 @@ public class DefaultPluginVersionManager
|
|||
DefaultArtifactVersion requiredVersion =
|
||||
new DefaultArtifactVersion( pluginProject.getPrerequisites().getMaven() );
|
||||
|
||||
if ( runtimeInformation.getApplicationVersion().compareTo( requiredVersion ) < 0 )
|
||||
if ( runtimeInformation.getApplicationVersion().compareTo( requiredVersion ) != 0 )
|
||||
{
|
||||
getLogger().info( "Ignoring available plugin update: " + artifactVersion +
|
||||
" as it requires Maven version " + requiredVersion );
|
||||
getLogger().info( "Ignoring available plugin version: " + artifactVersion +
|
||||
" for: " + groupId + ":" + artifactId + " as it requires Maven version " + requiredVersion );
|
||||
|
||||
VersionRange vr;
|
||||
try
|
||||
|
@ -264,15 +264,15 @@ public class DefaultPluginVersionManager
|
|||
if ( artifactVersion != null )
|
||||
{
|
||||
getLogger().debug( "Found " + artifactVersion );
|
||||
}
|
||||
else
|
||||
{
|
||||
pluginValid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !metaVersionId.equals( artifactVersion ) )
|
||||
{
|
||||
version = artifactVersion;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportAttemptToOverrideUneditableMojoParameter-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<version>1</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,39 @@
|
|||
package org.plugin;
|
||||
|
||||
import org.apache.maven.plugin.Mojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugin.logging.Log;
|
||||
|
||||
/**
|
||||
* @goal test
|
||||
*/
|
||||
public class TestPlugin
|
||||
implements Mojo
|
||||
{
|
||||
|
||||
private Log log;
|
||||
|
||||
/**
|
||||
* @parameter default-value="something"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String param;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
}
|
||||
|
||||
public Log getLog()
|
||||
{
|
||||
return log;
|
||||
}
|
||||
|
||||
public void setLog( Log log )
|
||||
{
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>testReportAttemptToOverrideUneditableMojoParameter</artifactId>
|
||||
<version>1</version>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportAttemptToOverrideUneditableMojoParameter-maven-plugin</artifactId>
|
||||
<version>1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test-run</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<param>something-else</param>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
Binary file not shown.
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportExtensionPluginVersionNotFound-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<version>1</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?><metadata>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportExtensionPluginVersionNotFound-maven-plugin</artifactId>
|
||||
<versioning>
|
||||
<versions>
|
||||
<version>1</version>
|
||||
</versions>
|
||||
<lastUpdated>20070331131500</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportIncompatibleMavenVersionForExtensionPlugin-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<version>1</version>
|
||||
|
||||
<!--
|
||||
<prerequisites>
|
||||
<maven>10</maven>
|
||||
</prerequisites>
|
||||
-->
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,33 @@
|
|||
package org.plugin;
|
||||
|
||||
import org.apache.maven.plugin.Mojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugin.logging.Log;
|
||||
|
||||
/**
|
||||
* @goal test
|
||||
*/
|
||||
public class TestPlugin
|
||||
implements Mojo
|
||||
{
|
||||
|
||||
private Log log;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
throw new MojoExecutionException( "This is meant to fail." );
|
||||
}
|
||||
|
||||
public Log getLog()
|
||||
{
|
||||
return log;
|
||||
}
|
||||
|
||||
public void setLog( Log log )
|
||||
{
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>testReportExtensionPluginVersionNotFound</artifactId>
|
||||
<version>1</version>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportExtensionPluginVersionNotFound-maven-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
Binary file not shown.
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportIncompatibleMavenVersionForExtensionPlugin-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<version>1</version>
|
||||
|
||||
<prerequisites>
|
||||
<maven>10</maven>
|
||||
</prerequisites>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?><metadata>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportIncompatibleMavenVersionForExtensionPlugin-maven-plugin</artifactId>
|
||||
<versioning>
|
||||
<latest>1</latest>
|
||||
<release>1</release>
|
||||
<versions>
|
||||
<version>1</version>
|
||||
</versions>
|
||||
<lastUpdated>20070331131500</lastUpdated>
|
||||
</versioning>
|
||||
</metadata>
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportIncompatibleMavenVersionForExtensionPlugin-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<version>1</version>
|
||||
|
||||
<!--
|
||||
<prerequisites>
|
||||
<maven>10</maven>
|
||||
</prerequisites>
|
||||
-->
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,33 @@
|
|||
package org.plugin;
|
||||
|
||||
import org.apache.maven.plugin.Mojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugin.logging.Log;
|
||||
|
||||
/**
|
||||
* @goal test
|
||||
*/
|
||||
public class TestPlugin
|
||||
implements Mojo
|
||||
{
|
||||
|
||||
private Log log;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
throw new MojoExecutionException( "This is meant to fail." );
|
||||
}
|
||||
|
||||
public Log getLog()
|
||||
{
|
||||
return log;
|
||||
}
|
||||
|
||||
public void setLog( Log log )
|
||||
{
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>testReportIncompatibleMavenVersionForExtensionPlugin</artifactId>
|
||||
<version>1</version>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportIncompatibleMavenVersionForExtensionPlugin-maven-plugin</artifactId>
|
||||
<version>1</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
Binary file not shown.
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportInvalidDependencyVersionInExtensionPluginPOM-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<version>1</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>[3.8.1,</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportIncompatibleMavenVersionForExtensionPlugin-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<version>1</version>
|
||||
|
||||
<!--
|
||||
<prerequisites>
|
||||
<maven>10</maven>
|
||||
</prerequisites>
|
||||
-->
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,33 @@
|
|||
package org.plugin;
|
||||
|
||||
import org.apache.maven.plugin.Mojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugin.logging.Log;
|
||||
|
||||
/**
|
||||
* @goal test
|
||||
*/
|
||||
public class TestPlugin
|
||||
implements Mojo
|
||||
{
|
||||
|
||||
private Log log;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
throw new MojoExecutionException( "This is meant to fail." );
|
||||
}
|
||||
|
||||
public Log getLog()
|
||||
{
|
||||
return log;
|
||||
}
|
||||
|
||||
public void setLog( Log log )
|
||||
{
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>testReportInvalidDependencyVersionInExtensionPluginPOM</artifactId>
|
||||
<version>1</version>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportInvalidDependencyVersionInExtensionPluginPOM-maven-plugin</artifactId>
|
||||
<version>1</version>
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportMissingRequiredMojoParameter-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<version>1</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,38 @@
|
|||
package org.plugin;
|
||||
|
||||
import org.apache.maven.plugin.Mojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugin.logging.Log;
|
||||
|
||||
/**
|
||||
* @goal test
|
||||
*/
|
||||
public class TestPlugin
|
||||
implements Mojo
|
||||
{
|
||||
|
||||
private Log log;
|
||||
|
||||
/**
|
||||
* @parameter
|
||||
* @required
|
||||
*/
|
||||
private String requiredParam;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
}
|
||||
|
||||
public Log getLog()
|
||||
{
|
||||
return log;
|
||||
}
|
||||
|
||||
public void setLog( Log log )
|
||||
{
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>testReportMissingRequiredMojoParameter</artifactId>
|
||||
<version>1</version>
|
||||
</project>
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.errortest</groupId>
|
||||
<artifactId>testReportMojoExecutionException-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<version>1</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,33 @@
|
|||
package org.plugin;
|
||||
|
||||
import org.apache.maven.plugin.Mojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugin.logging.Log;
|
||||
|
||||
/**
|
||||
* @goal test
|
||||
*/
|
||||
public class TestPlugin
|
||||
implements Mojo
|
||||
{
|
||||
|
||||
private Log log;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
throw new MojoExecutionException( "This is meant to fail." );
|
||||
}
|
||||
|
||||
public Log getLog()
|
||||
{
|
||||
return log;
|
||||
}
|
||||
|
||||
public void setLog( Log log )
|
||||
{
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>testReportMojoExecutionException</artifactId>
|
||||
<version>1</version>
|
||||
|
||||
</project>
|
|
@ -17,6 +17,7 @@ import org.apache.maven.execution.MavenExecutionResult;
|
|||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||
import org.apache.maven.plugin.PluginManagerException;
|
||||
import org.apache.maven.settings.Settings;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
import org.easymock.MockControl;
|
||||
|
@ -279,9 +280,35 @@ public class ErrorReporterPointcutTest
|
|||
}
|
||||
|
||||
public void testReportAttemptToOverrideUneditableMojoParameter()
|
||||
throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
if ( !checkOnline() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
File projectDir = prepareProjectDir();
|
||||
|
||||
buildTestAccessory( new File( projectDir, "plugin" ) );
|
||||
|
||||
File basedir = new File( projectDir, "project" );
|
||||
|
||||
reporter.reportAttemptToOverrideUneditableMojoParameter( null, null, null, null, null, null, null, null );
|
||||
reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
|
||||
reporterCtl.setVoidCallable();
|
||||
|
||||
reporterCtl.replay();
|
||||
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir )
|
||||
.setShowErrors( true )
|
||||
.setErrorReporter( reporter )
|
||||
.setGoals( Arrays.asList( new String[] {
|
||||
"initialize"
|
||||
} ) );
|
||||
|
||||
maven.execute( request );
|
||||
|
||||
reporterCtl.verify();
|
||||
}
|
||||
|
||||
public void testReportErrorApplyingMojoConfiguration()
|
||||
|
@ -444,12 +471,6 @@ public class ErrorReporterPointcutTest
|
|||
reporterCtl.verify();
|
||||
}
|
||||
|
||||
public void testReportErrorSearchingforCompatibleExtensionPluginVersion()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void testReportExtensionPluginArtifactNotFound()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
@ -457,21 +478,91 @@ public class ErrorReporterPointcutTest
|
|||
}
|
||||
|
||||
public void testReportExtensionPluginVersionNotFound()
|
||||
throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
File projectDir = prepareProjectDir();
|
||||
File localRepo = new File( projectDir, "local-repo" );
|
||||
File project = new File( projectDir, "project" );
|
||||
|
||||
Settings settings = new Settings();
|
||||
settings.setOffline( true );
|
||||
settings.setLocalRepository( localRepo.getAbsolutePath() );
|
||||
|
||||
reporter.reportExtensionPluginVersionNotFound( null, null, null, null, null );
|
||||
reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
|
||||
reporterCtl.setVoidCallable();
|
||||
|
||||
reporterCtl.replay();
|
||||
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
|
||||
.setShowErrors( true )
|
||||
.setLoggingLevel( Logger.LEVEL_DEBUG )
|
||||
.setSettings( settings )
|
||||
.setErrorReporter( reporter )
|
||||
.setGoals( Arrays.asList( new String[] {
|
||||
"initialize"
|
||||
} ) );
|
||||
|
||||
maven.execute( request );
|
||||
|
||||
reporterCtl.verify();
|
||||
}
|
||||
|
||||
public void testReportIncompatibleMavenVersionForExtensionPlugin()
|
||||
throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
File projectDir = prepareProjectDir();
|
||||
File localRepo = new File( projectDir, "local-repo" );
|
||||
File project = new File( projectDir, "project" );
|
||||
|
||||
reporter.reportIncompatibleMavenVersionForExtensionPlugin( null, null, null, null, null, null, null );
|
||||
reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
|
||||
reporterCtl.setVoidCallable();
|
||||
|
||||
reporterCtl.replay();
|
||||
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
|
||||
.setShowErrors( true )
|
||||
.setLocalRepositoryPath( localRepo )
|
||||
.setErrorReporter( reporter )
|
||||
.setGoals( Arrays.asList( new String[] {
|
||||
"initialize"
|
||||
} ) );
|
||||
|
||||
maven.execute( request );
|
||||
|
||||
reporterCtl.verify();
|
||||
}
|
||||
|
||||
public void testReportInvalidDependencyVersionInExtensionPluginPOM()
|
||||
throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
File projectDir = prepareProjectDir();
|
||||
File localRepo = new File( projectDir, "local-repo" );
|
||||
File project = new File( projectDir, "project" );
|
||||
|
||||
// TODO: Verify that the actual error reported is the one that identified the failing project as an extension POM.
|
||||
reporter.reportBadDependencyVersion( null, null, null );
|
||||
reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
|
||||
reporterCtl.setVoidCallable();
|
||||
|
||||
reporter.reportInvalidDependencyVersionInExtensionPluginPOM( null, null, null, null, null );
|
||||
reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
|
||||
reporterCtl.setVoidCallable();
|
||||
|
||||
reporterCtl.replay();
|
||||
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
|
||||
.setShowErrors( true )
|
||||
.setLocalRepositoryPath( localRepo )
|
||||
.setErrorReporter( reporter )
|
||||
.setGoals( Arrays.asList( new String[] {
|
||||
"initialize"
|
||||
} ) );
|
||||
|
||||
maven.execute( request );
|
||||
|
||||
reporterCtl.verify();
|
||||
}
|
||||
|
||||
public void testReportInvalidMavenVersion()
|
||||
|
@ -581,15 +672,67 @@ public class ErrorReporterPointcutTest
|
|||
}
|
||||
|
||||
public void testReportMissingRequiredMojoParameter()
|
||||
throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
if ( !checkOnline() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
File projectDir = prepareProjectDir();
|
||||
|
||||
buildTestAccessory( new File( projectDir, "plugin" ) );
|
||||
|
||||
File basedir = new File( projectDir, "project" );
|
||||
|
||||
reporter.reportMissingRequiredMojoParameter( null, null, null, null );
|
||||
reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
|
||||
reporterCtl.setVoidCallable();
|
||||
|
||||
reporterCtl.replay();
|
||||
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir )
|
||||
.setShowErrors( true )
|
||||
.setErrorReporter( reporter )
|
||||
.setGoals( Arrays.asList( new String[] {
|
||||
"org.apache.maven.errortest:testReportMissingRequiredMojoParameter-maven-plugin:1:test"
|
||||
} ) );
|
||||
|
||||
maven.execute( request );
|
||||
|
||||
reporterCtl.verify();
|
||||
}
|
||||
|
||||
public void testReportMojoExecutionException()
|
||||
throws IOException
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
if ( !checkOnline() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
File projectDir = prepareProjectDir();
|
||||
|
||||
buildTestAccessory( new File( projectDir, "plugin" ) );
|
||||
|
||||
File basedir = new File( projectDir, "project" );
|
||||
|
||||
reporter.reportMojoExecutionException( null, null, null );
|
||||
reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
|
||||
reporterCtl.setVoidCallable();
|
||||
|
||||
reporterCtl.replay();
|
||||
|
||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir )
|
||||
.setShowErrors( true )
|
||||
.setErrorReporter( reporter )
|
||||
.setGoals( Arrays.asList( new String[] {
|
||||
"org.apache.maven.errortest:testReportMojoExecutionException-maven-plugin:1:test"
|
||||
} ) );
|
||||
|
||||
maven.execute( request );
|
||||
|
||||
reporterCtl.verify();
|
||||
}
|
||||
|
||||
public void testReportMojoLookupError()
|
||||
|
@ -734,18 +877,6 @@ public class ErrorReporterPointcutTest
|
|||
|
||||
}
|
||||
|
||||
public void testReportUnresolvableExtensionPluginPOM()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void testReportUseOfBannedMojoParameter()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void testReportActivatorError()
|
||||
throws IOException
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue