[maven-release-plugin] copy for tag maven-plugin-tools-3.2
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/tags/maven-plugin-tools-3.2@1406562 13f79535-47bb-0310-9956-ffa450edef68
commit
eef0a7817c
|
|
@ -23,7 +23,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-plugin-tools</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>maven-plugin-annotations</artifactId>
|
<artifactId>maven-plugin-annotations</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-plugin-tools</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,16 @@ package org.apache.maven.plugin.plugin;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
import org.apache.maven.plugins.annotations.Component;
|
||||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||||
import org.apache.maven.plugins.annotations.Mojo;
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
import org.apache.maven.plugins.annotations.Parameter;
|
import org.apache.maven.plugins.annotations.Parameter;
|
||||||
import org.apache.maven.plugins.annotations.ResolutionScope;
|
import org.apache.maven.plugins.annotations.ResolutionScope;
|
||||||
import org.apache.maven.tools.plugin.generator.Generator;
|
import org.apache.maven.tools.plugin.generator.Generator;
|
||||||
import org.apache.maven.tools.plugin.generator.PluginDescriptorGenerator;
|
import org.apache.maven.tools.plugin.generator.PluginDescriptorGenerator;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a plugin descriptor.
|
* Generate a plugin descriptor.
|
||||||
|
|
@ -43,7 +44,7 @@ import java.io.File;
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
*/
|
*/
|
||||||
@Mojo( name = "descriptor", defaultPhase = LifecyclePhase.PROCESS_CLASSES,
|
@Mojo( name = "descriptor", defaultPhase = LifecyclePhase.PROCESS_CLASSES,
|
||||||
requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true )
|
requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true )
|
||||||
public class DescriptorGeneratorMojo
|
public class DescriptorGeneratorMojo
|
||||||
extends AbstractGeneratorMojo
|
extends AbstractGeneratorMojo
|
||||||
{
|
{
|
||||||
|
|
@ -55,25 +56,35 @@ public class DescriptorGeneratorMojo
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A flag to disable generation of the <code>plugin.xml</code> in favor of a hand authored plugin descriptor.
|
* A flag to disable generation of the <code>plugin.xml</code> in favor of a hand authored plugin descriptor.
|
||||||
*
|
*
|
||||||
* @since 2.6
|
* @since 2.6
|
||||||
*/
|
*/
|
||||||
@Parameter( defaultValue = "false" )
|
@Parameter( defaultValue = "false" )
|
||||||
private boolean skipDescriptor;
|
private boolean skipDescriptor;
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
@Component
|
||||||
|
protected Logger logger;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
protected File getOutputDirectory()
|
protected File getOutputDirectory()
|
||||||
{
|
{
|
||||||
return outputDirectory;
|
return outputDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
protected Generator createGenerator()
|
protected Generator createGenerator()
|
||||||
{
|
{
|
||||||
return new PluginDescriptorGenerator();
|
return new PluginDescriptorGenerator( logger );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<artifactId>maven-plugin-tools</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>maven-plugin-tools-annotations</artifactId>
|
<artifactId>maven-plugin-tools-annotations</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<artifactId>maven-plugin-tools</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>maven-plugin-tools-ant</artifactId>
|
<artifactId>maven-plugin-tools-ant</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<artifactId>maven-plugin-tools</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>maven-plugin-tools-api</artifactId>
|
<artifactId>maven-plugin-tools-api</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<artifactId>maven-plugin-tools</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>maven-plugin-tools-beanshell</artifactId>
|
<artifactId>maven-plugin-tools-beanshell</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<artifactId>maven-plugin-tools</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>maven-plugin-tools-generators</artifactId>
|
<artifactId>maven-plugin-tools-generators</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -19,20 +19,6 @@ package org.apache.maven.tools.plugin.generator;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.plugin.descriptor.DuplicateMojoDescriptorException;
|
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
|
||||||
import org.apache.maven.plugin.descriptor.Parameter;
|
|
||||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
|
||||||
import org.apache.maven.plugin.descriptor.Requirement;
|
|
||||||
import org.apache.maven.project.MavenProject;
|
|
||||||
import org.apache.maven.tools.plugin.ExtendedMojoDescriptor;
|
|
||||||
import org.apache.maven.tools.plugin.PluginToolsRequest;
|
|
||||||
import org.apache.maven.tools.plugin.util.PluginUtils;
|
|
||||||
import org.codehaus.plexus.util.IOUtil;
|
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
|
|
||||||
import org.codehaus.plexus.util.xml.XMLWriter;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -45,6 +31,20 @@ import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import org.apache.maven.plugin.descriptor.DuplicateMojoDescriptorException;
|
||||||
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
|
import org.apache.maven.plugin.descriptor.Parameter;
|
||||||
|
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
|
import org.apache.maven.plugin.descriptor.Requirement;
|
||||||
|
import org.apache.maven.project.MavenProject;
|
||||||
|
import org.apache.maven.tools.plugin.ExtendedMojoDescriptor;
|
||||||
|
import org.apache.maven.tools.plugin.PluginToolsRequest;
|
||||||
|
import org.apache.maven.tools.plugin.util.PluginUtils;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
|
import org.codehaus.plexus.util.IOUtil;
|
||||||
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
|
||||||
|
import org.codehaus.plexus.util.xml.XMLWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a <a href="/ref/current/maven-plugin-api/plugin.html">Maven Plugin Descriptor XML file</a> and
|
* Generate a <a href="/ref/current/maven-plugin-api/plugin.html">Maven Plugin Descriptor XML file</a> and
|
||||||
|
|
@ -59,6 +59,13 @@ public class PluginDescriptorGenerator
|
||||||
implements Generator
|
implements Generator
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private final Logger log;
|
||||||
|
|
||||||
|
public PluginDescriptorGenerator( Logger log )
|
||||||
|
{
|
||||||
|
this.log = log;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
|
|
@ -66,7 +73,7 @@ public class PluginDescriptorGenerator
|
||||||
throws GeneratorException
|
throws GeneratorException
|
||||||
{
|
{
|
||||||
// eventually rewrite help mojo class to match actual package name
|
// eventually rewrite help mojo class to match actual package name
|
||||||
PluginHelpGenerator.rewriteHelpMojo( request );
|
PluginHelpGenerator.rewriteHelpMojo( request, log );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -77,8 +84,7 @@ public class PluginDescriptorGenerator
|
||||||
// write plugin-help.xml help-descriptor
|
// write plugin-help.xml help-descriptor
|
||||||
MavenProject mavenProject = request.getProject();
|
MavenProject mavenProject = request.getProject();
|
||||||
|
|
||||||
f =
|
f = new File( mavenProject.getBuild().getOutputDirectory(),
|
||||||
new File( mavenProject.getBuild().getOutputDirectory(),
|
|
||||||
PluginHelpGenerator.getPluginHelpPath( mavenProject ) );
|
PluginHelpGenerator.getPluginHelpPath( mavenProject ) );
|
||||||
|
|
||||||
writeDescriptor( f, request, true );
|
writeDescriptor( f, request, true );
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,7 @@ public class PluginHelpGenerator
|
||||||
* @param request
|
* @param request
|
||||||
* @throws GeneratorException
|
* @throws GeneratorException
|
||||||
*/
|
*/
|
||||||
static void rewriteHelpMojo( PluginToolsRequest request )
|
static void rewriteHelpMojo( PluginToolsRequest request, Logger log )
|
||||||
throws GeneratorException
|
throws GeneratorException
|
||||||
{
|
{
|
||||||
File tmpPropertiesFile =
|
File tmpPropertiesFile =
|
||||||
|
|
@ -303,8 +303,23 @@ public class PluginHelpGenerator
|
||||||
// if helpPackageName property is empty, we have to rewrite the class with a better package name than empty
|
// if helpPackageName property is empty, we have to rewrite the class with a better package name than empty
|
||||||
if ( StringUtils.isEmpty( helpPackageName ) )
|
if ( StringUtils.isEmpty( helpPackageName ) )
|
||||||
{
|
{
|
||||||
File destinationDirectory = new File( properties.getProperty( "destinationDirectory" ) );
|
String destDir = properties.getProperty( "destinationDirectory" );
|
||||||
String helpMojoImplementation = rewriteHelpClassToMojoPackage( request, destinationDirectory );
|
File destinationDirectory;
|
||||||
|
if ( StringUtils.isEmpty( destDir ) )
|
||||||
|
{
|
||||||
|
// writeHelpPropertiesFile() creates 2 properties: find one without the other should not be possible
|
||||||
|
log.warn( "\n\nUnexpected situation: destinationDirectory not defined in " + HELP_PROPERTIES_FILENAME
|
||||||
|
+ " during help mojo source generation but expected during XML descriptor generation." );
|
||||||
|
log.warn( "Please check helpmojo goal version used in previous build phase." );
|
||||||
|
log.warn("If you just upgraded to plugin-tools >= 3.2 you must run a clean build at least once");
|
||||||
|
destinationDirectory = new File( "target/generated-sources/plugin" );
|
||||||
|
log.warn( "Trying default location: " + destinationDirectory );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
destinationDirectory = new File( destDir );
|
||||||
|
}
|
||||||
|
String helpMojoImplementation = rewriteHelpClassToMojoPackage( request, destinationDirectory, log );
|
||||||
|
|
||||||
if ( helpMojoImplementation != null )
|
if ( helpMojoImplementation != null )
|
||||||
{
|
{
|
||||||
|
|
@ -314,7 +329,7 @@ public class PluginHelpGenerator
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String rewriteHelpClassToMojoPackage( PluginToolsRequest request, File destinationDirectory )
|
private static String rewriteHelpClassToMojoPackage( PluginToolsRequest request, File destinationDirectory, Logger log )
|
||||||
throws GeneratorException
|
throws GeneratorException
|
||||||
{
|
{
|
||||||
String destinationPackage = GeneratorUtils.discoverPackageName( request.getPluginDescriptor() );
|
String destinationPackage = GeneratorUtils.discoverPackageName( request.getPluginDescriptor() );
|
||||||
|
|
@ -333,34 +348,42 @@ public class PluginHelpGenerator
|
||||||
|
|
||||||
// rewrite help mojo source
|
// rewrite help mojo source
|
||||||
File helpSourceFile = new File( destinationDirectory, HELP_MOJO_CLASS_NAME + ".java" );
|
File helpSourceFile = new File( destinationDirectory, HELP_MOJO_CLASS_NAME + ".java" );
|
||||||
File helpSourceFileNew = new File( destinationDirectory, packageAsDirectory + '/' + HELP_MOJO_CLASS_NAME + ".java" );
|
if ( !helpSourceFile.exists() )
|
||||||
if ( !helpSourceFileNew.getParentFile().exists() )
|
|
||||||
{
|
{
|
||||||
helpSourceFileNew.getParentFile().mkdirs();
|
log.warn( "HelpMojo.java not found in default location: " + helpSourceFile.getAbsolutePath() );
|
||||||
|
log.warn( "Help goal source won't be moved to package: " + destinationPackage );
|
||||||
}
|
}
|
||||||
Reader sourceReader = null;
|
else
|
||||||
PrintWriter sourceWriter = null;
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
sourceReader = new InputStreamReader( new FileInputStream( helpSourceFile ), request.getEncoding() );
|
File helpSourceFileNew = new File( destinationDirectory, packageAsDirectory + '/' + HELP_MOJO_CLASS_NAME + ".java" );
|
||||||
sourceWriter =
|
if ( !helpSourceFileNew.getParentFile().exists() )
|
||||||
new PrintWriter( new OutputStreamWriter( new FileOutputStream( helpSourceFileNew ),
|
{
|
||||||
request.getEncoding() ) );
|
helpSourceFileNew.getParentFile().mkdirs();
|
||||||
|
}
|
||||||
sourceWriter.println( "package " + destinationPackage + ";" );
|
Reader sourceReader = null;
|
||||||
IOUtil.copy( sourceReader, sourceWriter );
|
PrintWriter sourceWriter = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sourceReader = new InputStreamReader( new FileInputStream( helpSourceFile ), request.getEncoding() );
|
||||||
|
sourceWriter =
|
||||||
|
new PrintWriter( new OutputStreamWriter( new FileOutputStream( helpSourceFileNew ),
|
||||||
|
request.getEncoding() ) );
|
||||||
|
|
||||||
|
sourceWriter.println( "package " + destinationPackage + ";" );
|
||||||
|
IOUtil.copy( sourceReader, sourceWriter );
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
throw new GeneratorException( e.getMessage(), e );
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IOUtil.close( sourceReader );
|
||||||
|
IOUtil.close( sourceWriter );
|
||||||
|
}
|
||||||
|
helpSourceFileNew.setLastModified( helpSourceFile.lastModified() );
|
||||||
|
helpSourceFile.delete();
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
|
||||||
{
|
|
||||||
throw new GeneratorException( e.getMessage(), e );
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
IOUtil.close( sourceReader );
|
|
||||||
IOUtil.close( sourceWriter );
|
|
||||||
}
|
|
||||||
helpSourceFileNew.setLastModified( helpSourceFile.lastModified() );
|
|
||||||
helpSourceFile.delete();
|
|
||||||
|
|
||||||
// rewrite help mojo .class
|
// rewrite help mojo .class
|
||||||
File rewriteHelpClassFile =
|
File rewriteHelpClassFile =
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,11 @@ package org.apache.maven.tools.plugin.generator;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import org.apache.maven.model.Build;
|
import org.apache.maven.model.Build;
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
import org.apache.maven.plugin.descriptor.Parameter;
|
import org.apache.maven.plugin.descriptor.Parameter;
|
||||||
|
|
@ -27,13 +32,9 @@ import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
|
import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
import org.codehaus.plexus.PlexusTestCase;
|
||||||
import org.codehaus.plexus.component.repository.ComponentDependency;
|
import org.codehaus.plexus.component.repository.ComponentDependency;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
||||||
* @version $Id: AbstractGeneratorTestCase.java,v 1.1 2005/02/20 16:25:21
|
* @version $Id: AbstractGeneratorTestCase.java,v 1.1 2005/02/20 16:25:21
|
||||||
|
|
@ -136,7 +137,17 @@ public abstract class AbstractGeneratorTestCase
|
||||||
{
|
{
|
||||||
Class<?> generatorClass = Thread.currentThread().getContextClassLoader().loadClass( generatorClassName );
|
Class<?> generatorClass = Thread.currentThread().getContextClassLoader().loadClass( generatorClassName );
|
||||||
|
|
||||||
generator = (Generator) generatorClass.newInstance();
|
Logger logger = getContainer().getLogger();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Constructor<?> constructor = generatorClass.getConstructor( Logger.class );
|
||||||
|
generator = (Generator) constructor.newInstance( logger );
|
||||||
|
}
|
||||||
|
catch ( NoSuchMethodException ignore )
|
||||||
|
{
|
||||||
|
generator = (Generator) generatorClass.newInstance();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<artifactId>maven-plugin-tools</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>maven-plugin-tools-java</artifactId>
|
<artifactId>maven-plugin-tools-java</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,10 @@ package org.apache.maven.tools.plugin.extractor.java;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import java.io.File;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import org.apache.maven.model.Build;
|
import org.apache.maven.model.Build;
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||||
|
|
@ -36,15 +39,12 @@ import org.codehaus.plexus.component.repository.ComponentDependency;
|
||||||
import org.codehaus.plexus.logging.Logger;
|
import org.codehaus.plexus.logging.Logger;
|
||||||
import org.codehaus.plexus.logging.console.ConsoleLogger;
|
import org.codehaus.plexus.logging.console.ConsoleLogger;
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
import org.custommonkey.xmlunit.Diff;
|
import org.custommonkey.xmlunit.Diff;
|
||||||
import org.custommonkey.xmlunit.XMLUnit;
|
import org.custommonkey.xmlunit.XMLUnit;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jdcasey
|
* @author jdcasey
|
||||||
*/
|
*/
|
||||||
|
|
@ -79,13 +79,14 @@ public class JavaMojoDescriptorExtractorTest
|
||||||
model.setArtifactId( "maven-unitTesting-plugin" );
|
model.setArtifactId( "maven-unitTesting-plugin" );
|
||||||
|
|
||||||
MavenProject project = new MavenProject( model );
|
MavenProject project = new MavenProject( model );
|
||||||
project.setBuild( new Build(){
|
project.setBuild( new Build()
|
||||||
|
{
|
||||||
@Override
|
@Override
|
||||||
public String getOutputDirectory()
|
public String getOutputDirectory()
|
||||||
{
|
{
|
||||||
return System.getProperty( "filePath" );
|
return System.getProperty( "filePath" );
|
||||||
}
|
}
|
||||||
});
|
} );
|
||||||
|
|
||||||
project.setFile( new File( root, "pom.xml" ) );
|
project.setFile( new File( root, "pom.xml" ) );
|
||||||
project.addCompileSourceRoot( new File( root, directory ).getPath() );
|
project.addCompileSourceRoot( new File( root, directory ).getPath() );
|
||||||
|
|
@ -120,7 +121,7 @@ public class JavaMojoDescriptorExtractorTest
|
||||||
request.getPluginDescriptor().addMojo( mojoDescriptor );
|
request.getPluginDescriptor().addMojo( mojoDescriptor );
|
||||||
}
|
}
|
||||||
|
|
||||||
Generator descriptorGenerator = new PluginDescriptorGenerator();
|
Generator descriptorGenerator = new PluginDescriptorGenerator( new ConsoleLogger( 0, "A" ) );
|
||||||
|
|
||||||
descriptorGenerator.execute( new File( root, directory ), request );
|
descriptorGenerator.execute( new File( root, directory ), request );
|
||||||
|
|
||||||
|
|
@ -137,9 +138,9 @@ public class JavaMojoDescriptorExtractorTest
|
||||||
|
|
||||||
XMLUnit.setIgnoreWhitespace( true );
|
XMLUnit.setIgnoreWhitespace( true );
|
||||||
XMLUnit.setIgnoreComments( true );
|
XMLUnit.setIgnoreComments( true );
|
||||||
|
|
||||||
Document expected =
|
Document expected = XMLUnit.buildControlDocument(
|
||||||
XMLUnit.buildControlDocument( FileUtils.fileRead( new File( testDirectory, "plugin-expected.xml" ), "UTF-8" ) );
|
FileUtils.fileRead( new File( testDirectory, "plugin-expected.xml" ), "UTF-8" ) );
|
||||||
Document actual =
|
Document actual =
|
||||||
XMLUnit.buildTestDocument( FileUtils.fileRead( new File( testDirectory, "plugin.xml" ), "UTF-8" ) );
|
XMLUnit.buildTestDocument( FileUtils.fileRead( new File( testDirectory, "plugin.xml" ), "UTF-8" ) );
|
||||||
|
|
||||||
|
|
@ -182,8 +183,7 @@ public class JavaMojoDescriptorExtractorTest
|
||||||
|
|
||||||
MojoDescriptor mojoDescriptor = results.get( 0 );
|
MojoDescriptor mojoDescriptor = results.get( 0 );
|
||||||
|
|
||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings( "unchecked" ) List<Parameter> parameters = mojoDescriptor.getParameters();
|
||||||
List<Parameter> parameters = mojoDescriptor.getParameters();
|
|
||||||
|
|
||||||
assertEquals( 1, parameters.size() );
|
assertEquals( 1, parameters.size() );
|
||||||
|
|
||||||
|
|
@ -206,7 +206,7 @@ public class JavaMojoDescriptorExtractorTest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that the mojo descriptor extractor will ignore any annotations that are found.
|
* Check that the mojo descriptor extractor will ignore any annotations that are found.
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public void testAnnotationInPlugin()
|
public void testAnnotationInPlugin()
|
||||||
|
|
@ -216,7 +216,7 @@ public class JavaMojoDescriptorExtractorTest
|
||||||
|
|
||||||
assertNull( results );
|
assertNull( results );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that the mojo descriptor extractor will successfully parse sources with Java 1.5 language features like
|
* Check that the mojo descriptor extractor will successfully parse sources with Java 1.5 language features like
|
||||||
* generics.
|
* generics.
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<artifactId>maven-plugin-tools</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>maven-plugin-tools-javadoc</artifactId>
|
<artifactId>maven-plugin-tools-javadoc</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<artifactId>maven-plugin-tools</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>maven-plugin-tools-model</artifactId>
|
<artifactId>maven-plugin-tools-model</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ under the License.
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<artifactId>maven-script</artifactId>
|
<artifactId>maven-script</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>maven-script-ant</artifactId>
|
<artifactId>maven-script-ant</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ under the License.
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<artifactId>maven-script</artifactId>
|
<artifactId>maven-script</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>maven-script-beanshell</artifactId>
|
<artifactId>maven-script-beanshell</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ under the License.
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<artifactId>maven-plugin-tools</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>maven-script</artifactId>
|
<artifactId>maven-script</artifactId>
|
||||||
|
|
|
||||||
13
pom.xml
13
pom.xml
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
<artifactId>maven-plugin-tools</artifactId>
|
<artifactId>maven-plugin-tools</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.3-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>Maven Plugin Tools</name>
|
<name>Maven Plugin Tools</name>
|
||||||
|
|
@ -142,9 +142,9 @@
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<scm>
|
<scm>
|
||||||
<connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugin-tools/tags/maven-plugin-tools-3.2</connection>
|
<connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugin-tools/trunk</connection>
|
||||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugin-tools/tags/maven-plugin-tools-3.2</developerConnection>
|
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugin-tools/trunk</developerConnection>
|
||||||
<url>http://svn.apache.org/viewvc/maven/plugin-tools/tags/maven-plugin-tools-3.2</url>
|
<url>http://svn.apache.org/viewvc/maven/plugin-tools/trunk</url>
|
||||||
</scm>
|
</scm>
|
||||||
<issueManagement>
|
<issueManagement>
|
||||||
<system>jira</system>
|
<system>jira</system>
|
||||||
|
|
@ -375,6 +375,11 @@
|
||||||
<id>reporting</id>
|
<id>reporting</id>
|
||||||
<reporting>
|
<reporting>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin><!-- TODO remove when upgrading parent to version 23 -->
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue