You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2023/05/15 19:58:06 UTC
[maven-source-plugin] 01/01: [MSOURCES-133] Upgrade Parent to 39
This is an automated email from the ASF dual-hosted git repository.
sjaranowski pushed a commit to branch MSOURCES-133
in repository https://gitbox.apache.org/repos/asf/maven-source-plugin.git
commit 6590a34cb90b4b2a324606ddf8fac7e31eb69e70
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Mon May 15 21:57:47 2023 +0200
[MSOURCES-133] Upgrade Parent to 39
---
pom.xml | 24 +-
.../plugins/source/AbstractSourceJarMojo.java | 349 +++++++++------------
.../plugins/source/AggregatorSourceJarMojo.java | 20 +-
.../apache/maven/plugins/source/SourceJarMojo.java | 11 +-
.../maven/plugins/source/SourceJarNoForkMojo.java | 23 +-
.../plugins/source/TestSourceGeneratedJarMojo.java | 11 +-
.../maven/plugins/source/TestSourceJarMojo.java | 11 +-
.../plugins/source/TestSourceJarNoForkMojo.java | 42 +--
.../source/AbstractSourcePluginTestCase.java | 178 +++++------
.../maven/plugins/source/SourceJarMojoTest.java | 132 ++++----
.../plugins/source/TestSourceJarMojoTest.java | 99 +++---
.../source/stubs/DefaultArtifactHandlerStub.java | 31 +-
.../maven/plugins/source/stubs/Project001Stub.java | 127 ++++----
.../maven/plugins/source/stubs/Project003Stub.java | 99 +++---
.../maven/plugins/source/stubs/Project005Stub.java | 87 +++--
.../maven/plugins/source/stubs/Project007Stub.java | 100 +++---
.../maven/plugins/source/stubs/Project009Stub.java | 95 +++---
.../maven/plugins/source/stubs/Project010Stub.java | 93 +++---
.../source/stubs/SourcePluginArtifactStub.java | 70 ++---
19 files changed, 697 insertions(+), 905 deletions(-)
diff --git a/pom.xml b/pom.xml
index c3cd0e4..e29db42 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,4 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
+<?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
@@ -18,15 +17,14 @@ KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
- <artifactId>maven-plugins</artifactId>
<groupId>org.apache.maven.plugins</groupId>
- <version>36</version>
- <relativePath/>
+ <artifactId>maven-plugins</artifactId>
+ <version>39</version>
+ <relativePath />
</parent>
<artifactId>maven-source-plugin</artifactId>
@@ -36,10 +34,6 @@ under the License.
<name>Apache Maven Source Plugin</name>
<description>The Maven Source Plugin creates a JAR archive of the source files of the current project.</description>
- <prerequisites>
- <maven>${mavenVersion}</maven>
- </prerequisites>
-
<contributors>
<contributor>
<name>Marvin Froeder</name>
@@ -57,11 +51,15 @@ under the License.
</contributor>
</contributors>
+ <prerequisites>
+ <maven>${mavenVersion}</maven>
+ </prerequisites>
+
<scm>
<connection>scm:git:https://gitbox.apache.org/repos/asf/maven-source-plugin.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-source-plugin.git</developerConnection>
- <url>https://github.com/apache/maven-source-plugin/tree/${project.scm.tag}</url>
<tag>HEAD</tag>
+ <url>https://github.com/apache/maven-source-plugin/tree/${project.scm.tag}</url>
</scm>
<issueManagement>
<system>JIRA</system>
@@ -116,7 +114,7 @@ under the License.
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>
-
+
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
@@ -132,7 +130,7 @@ under the License.
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
-
+
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
diff --git a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
index dab4cbc..52c0d75 100644
--- a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.source;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.source;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source;
import java.io.File;
import java.io.IOException;
@@ -49,10 +48,8 @@ import org.codehaus.plexus.util.FileUtils;
*
* @since 2.0.3
*/
-public abstract class AbstractSourceJarMojo
- extends AbstractMojo
-{
- private static final String[] DEFAULT_INCLUDES = new String[] { "**/**" };
+public abstract class AbstractSourceJarMojo extends AbstractMojo {
+ private static final String[] DEFAULT_INCLUDES = new String[] {"**/**"};
private static final String[] DEFAULT_EXCLUDES = new String[] {};
@@ -80,19 +77,19 @@ public abstract class AbstractSourceJarMojo
*
* @since 2.1
*/
- @Parameter( property = "maven.source.useDefaultExcludes", defaultValue = "true" )
+ @Parameter(property = "maven.source.useDefaultExcludes", defaultValue = "true")
private boolean useDefaultExcludes;
/**
* The Maven Project Object
*/
- @Parameter( defaultValue = "${project}", readonly = true, required = true )
+ @Parameter(defaultValue = "${project}", readonly = true, required = true)
private MavenProject project;
/**
* The Jar archiver.
*/
- @Component( role = Archiver.class, hint = "jar" )
+ @Component(role = Archiver.class, hint = "jar")
private JarArchiver jarArchiver;
/**
@@ -101,7 +98,7 @@ public abstract class AbstractSourceJarMojo
* <b>Note: Since 3.0.0 the resulting archives contain a maven descriptor. If you need to suppress the generation of
* the maven descriptor you can simply achieve this by using the
* <a href="http://maven.apache.org/shared/maven-archiver/index.html#archive">archiver configuration</a>.</b>.
- *
+ *
* @since 2.1
*/
@Parameter
@@ -114,7 +111,10 @@ public abstract class AbstractSourceJarMojo
* @since 2.1
*/
// CHECKSTYLE_OFF: LineLength
- @Parameter( defaultValue = "${project.build.outputDirectory}/META-INF/MANIFEST.MF", readonly = false, required = true )
+ @Parameter(
+ defaultValue = "${project.build.outputDirectory}/META-INF/MANIFEST.MF",
+ readonly = false,
+ required = true)
// CHECKSTYLE_ON: LineLength
private File defaultManifestFile;
@@ -123,13 +123,13 @@ public abstract class AbstractSourceJarMojo
*
* @since 2.1
*/
- @Parameter( property = "maven.source.useDefaultManifestFile", defaultValue = "false" )
+ @Parameter(property = "maven.source.useDefaultManifestFile", defaultValue = "false")
private boolean useDefaultManifestFile;
/**
* Specifies whether or not to attach the artifact to the project
*/
- @Parameter( property = "maven.source.attach", defaultValue = "true" )
+ @Parameter(property = "maven.source.attach", defaultValue = "true")
private boolean attach;
/**
@@ -138,7 +138,7 @@ public abstract class AbstractSourceJarMojo
*
* @since 2.0.4
*/
- @Parameter( property = "maven.source.excludeResources", defaultValue = "false" )
+ @Parameter(property = "maven.source.excludeResources", defaultValue = "false")
protected boolean excludeResources;
/**
@@ -146,7 +146,7 @@ public abstract class AbstractSourceJarMojo
*
* @since 2.1
*/
- @Parameter( property = "maven.source.includePom", defaultValue = "false" )
+ @Parameter(property = "maven.source.includePom", defaultValue = "false")
protected boolean includePom;
/**
@@ -158,20 +158,20 @@ public abstract class AbstractSourceJarMojo
/**
* The directory where the generated archive file will be put.
*/
- @Parameter( defaultValue = "${project.build.directory}" )
+ @Parameter(defaultValue = "${project.build.directory}")
protected File outputDirectory;
/**
* The filename to be used for the generated archive file. For the source:jar goal, "-sources" is appended to this
* filename. For the source:test-jar goal, "-test-sources" is appended.
*/
- @Parameter( defaultValue = "${project.build.finalName}" )
+ @Parameter(defaultValue = "${project.build.finalName}")
protected String finalName;
/**
* Contains the full list of projects in the reactor.
*/
- @Parameter( defaultValue = "${reactorProjects}", readonly = true )
+ @Parameter(defaultValue = "${reactorProjects}", readonly = true)
protected List<MavenProject> reactorProjects;
/**
@@ -180,7 +180,7 @@ public abstract class AbstractSourceJarMojo
*
* @since 2.1
*/
- @Parameter( property = "maven.source.forceCreation", defaultValue = "false" )
+ @Parameter(property = "maven.source.forceCreation", defaultValue = "false")
private boolean forceCreation;
/**
@@ -189,13 +189,13 @@ public abstract class AbstractSourceJarMojo
*
* @since 2.2
*/
- @Parameter( property = "maven.source.skip", defaultValue = "false" )
+ @Parameter(property = "maven.source.skip", defaultValue = "false")
private boolean skipSource;
/**
* The Maven session.
*/
- @Parameter( defaultValue = "${session}", readonly = true, required = true )
+ @Parameter(defaultValue = "${session}", readonly = true, required = true)
private MavenSession session;
/**
@@ -205,7 +205,7 @@ public abstract class AbstractSourceJarMojo
*
* @since 3.2.0
*/
- @Parameter( defaultValue = "${project.build.outputTimestamp}" )
+ @Parameter(defaultValue = "${project.build.outputTimestamp}")
private String outputTimestamp;
// ----------------------------------------------------------------------
@@ -215,16 +215,13 @@ public abstract class AbstractSourceJarMojo
/**
* {@inheritDoc}
*/
- public void execute()
- throws MojoExecutionException
- {
- if ( skipSource )
- {
- getLog().info( "Skipping source per configuration." );
+ public void execute() throws MojoExecutionException {
+ if (skipSource) {
+ getLog().info("Skipping source per configuration.");
return;
}
- packageSources( project );
+ packageSources(project);
}
// ----------------------------------------------------------------------
@@ -241,27 +238,22 @@ public abstract class AbstractSourceJarMojo
* @return the compile or test sources
* @throws MojoExecutionException in case of an error.
*/
- protected abstract List<String> getSources( MavenProject p )
- throws MojoExecutionException;
+ protected abstract List<String> getSources(MavenProject p) throws MojoExecutionException;
/**
* @param p {@link MavenProject} not null
* @return the compile or test resources
* @throws MojoExecutionException in case of an error.
*/
- protected abstract List<Resource> getResources( MavenProject p )
- throws MojoExecutionException;
+ protected abstract List<Resource> getResources(MavenProject p) throws MojoExecutionException;
/**
* @param p {@link MavenProject}
* @throws MojoExecutionException in case of an error.
*/
- protected void packageSources( MavenProject p )
- throws MojoExecutionException
- {
- if ( !"pom".equals( p.getPackaging() ) )
- {
- packageSources( Collections.singletonList( p ) );
+ protected void packageSources(MavenProject p) throws MojoExecutionException {
+ if (!"pom".equals(p.getPackaging())) {
+ packageSources(Collections.singletonList(p));
}
}
@@ -269,89 +261,70 @@ public abstract class AbstractSourceJarMojo
* @param theProjects {@link MavenProject}
* @throws MojoExecutionException in case of an error.
*/
- protected void packageSources( List<MavenProject> theProjects )
- throws MojoExecutionException
- {
- if ( project.getArtifact().getClassifier() != null )
- {
- getLog().warn( "NOT adding sources to artifacts with classifier as Maven only supports one classifier "
- + "per artifact. Current artifact [" + project.getArtifact().getId() + "] has a ["
- + project.getArtifact().getClassifier() + "] classifier." );
+ protected void packageSources(List<MavenProject> theProjects) throws MojoExecutionException {
+ if (project.getArtifact().getClassifier() != null) {
+ getLog().warn("NOT adding sources to artifacts with classifier as Maven only supports one classifier "
+ + "per artifact. Current artifact [" + project.getArtifact().getId() + "] has a ["
+ + project.getArtifact().getClassifier() + "] classifier.");
return;
}
MavenArchiver archiver = createArchiver();
- for ( MavenProject pItem : theProjects )
- {
- MavenProject subProject = getProject( pItem );
+ for (MavenProject pItem : theProjects) {
+ MavenProject subProject = getProject(pItem);
- if ( "pom".equals( subProject.getPackaging() ) )
- {
+ if ("pom".equals(subProject.getPackaging())) {
continue;
}
- archiveProjectContent( subProject, archiver.getArchiver() );
+ archiveProjectContent(subProject, archiver.getArchiver());
}
- if ( archiver.getArchiver().getResources().hasNext() || forceCreation )
- {
+ if (archiver.getArchiver().getResources().hasNext() || forceCreation) {
- if ( useDefaultManifestFile && defaultManifestFile.exists() && archive.getManifestFile() == null )
- {
- getLog().info( "Adding existing MANIFEST to archive. Found under: " + defaultManifestFile.getPath() );
- archive.setManifestFile( defaultManifestFile );
+ if (useDefaultManifestFile && defaultManifestFile.exists() && archive.getManifestFile() == null) {
+ getLog().info("Adding existing MANIFEST to archive. Found under: " + defaultManifestFile.getPath());
+ archive.setManifestFile(defaultManifestFile);
}
- File outputFile = new File( outputDirectory, finalName + "-" + getClassifier() + getExtension() );
+ File outputFile = new File(outputDirectory, finalName + "-" + getClassifier() + getExtension());
- try
- {
- archiver.setOutputFile( outputFile );
- archive.setForced( forceCreation );
+ try {
+ archiver.setOutputFile(outputFile);
+ archive.setForced(forceCreation);
- getLog().debug( "create archive " + outputFile );
- archiver.createArchive( session, project, archive );
- }
- catch ( IOException | ArchiverException | DependencyResolutionRequiredException | ManifestException e )
- {
- throw new MojoExecutionException( "Error creating source archive: " + e.getMessage(), e );
+ getLog().debug("create archive " + outputFile);
+ archiver.createArchive(session, project, archive);
+ } catch (IOException | ArchiverException | DependencyResolutionRequiredException | ManifestException e) {
+ throw new MojoExecutionException("Error creating source archive: " + e.getMessage(), e);
}
- if ( attach )
- {
- for ( Artifact attachedArtifact : project.getAttachedArtifacts() )
- {
- if ( isAlreadyAttached( attachedArtifact, project, getClassifier() ) )
- {
- getLog().error( "We have duplicated artifacts attached." );
- throw new MojoExecutionException( "Presumably you have configured maven-source-plugn "
+ if (attach) {
+ for (Artifact attachedArtifact : project.getAttachedArtifacts()) {
+ if (isAlreadyAttached(attachedArtifact, project, getClassifier())) {
+ getLog().error("We have duplicated artifacts attached.");
+ throw new MojoExecutionException("Presumably you have configured maven-source-plugn "
+ "to execute twice times in your build. You have to configure a classifier "
- + "for at least on of them." );
+ + "for at least on of them.");
}
}
- projectHelper.attachArtifact( project, getType(), getClassifier(), outputFile );
- }
- else
- {
- getLog().info( "NOT adding java-sources to attached artifacts list." );
+ projectHelper.attachArtifact(project, getType(), getClassifier(), outputFile);
+ } else {
+ getLog().info("NOT adding java-sources to attached artifacts list.");
}
- }
- else
- {
- getLog().info( "No sources in project. Archive not created." );
+ } else {
+ getLog().info("No sources in project. Archive not created.");
}
}
- private boolean isAlreadyAttached( Artifact artifact, MavenProject checkProject, String classifier )
- {
- return artifact.getType().equals( getType() )
- && artifact.getGroupId().equals( checkProject.getGroupId() )
- && artifact.getArtifactId().equals( checkProject.getArtifactId() )
- && artifact.getVersion().equals( checkProject.getVersion() )
- && ( artifact.getClassifier() != null
- ? artifact.getClassifier().equals( classifier ) : false );
+ private boolean isAlreadyAttached(Artifact artifact, MavenProject checkProject, String classifier) {
+ return artifact.getType().equals(getType())
+ && artifact.getGroupId().equals(checkProject.getGroupId())
+ && artifact.getArtifactId().equals(checkProject.getArtifactId())
+ && artifact.getVersion().equals(checkProject.getVersion())
+ && (artifact.getClassifier() != null ? artifact.getClassifier().equals(classifier) : false);
}
/**
@@ -359,63 +332,49 @@ public abstract class AbstractSourceJarMojo
* @param archiver {@link Archiver}
* @throws MojoExecutionException in case of an error.
*/
- protected void archiveProjectContent( MavenProject p, Archiver archiver )
- throws MojoExecutionException
- {
- if ( includePom )
- {
- try
- {
- archiver.addFile( p.getFile(), p.getFile().getName() );
- }
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException( "Error adding POM file to target jar file.", e );
+ protected void archiveProjectContent(MavenProject p, Archiver archiver) throws MojoExecutionException {
+ if (includePom) {
+ try {
+ archiver.addFile(p.getFile(), p.getFile().getName());
+ } catch (ArchiverException e) {
+ throw new MojoExecutionException("Error adding POM file to target jar file.", e);
}
}
- for ( String s : getSources( p ) )
- {
+ for (String s : getSources(p)) {
- File sourceDirectory = new File( s );
+ File sourceDirectory = new File(s);
- if ( sourceDirectory.exists() )
- {
- addDirectory( archiver, sourceDirectory, getCombinedIncludes( null ), getCombinedExcludes( null ) );
+ if (sourceDirectory.exists()) {
+ addDirectory(archiver, sourceDirectory, getCombinedIncludes(null), getCombinedExcludes(null));
}
}
// MAPI: this should be taken from the resources plugin
- for ( Resource resource : getResources( p ) )
- {
+ for (Resource resource : getResources(p)) {
- File sourceDirectory = new File( resource.getDirectory() );
+ File sourceDirectory = new File(resource.getDirectory());
- if ( !sourceDirectory.exists() )
- {
+ if (!sourceDirectory.exists()) {
continue;
}
List<String> resourceIncludes = resource.getIncludes();
- String[] combinedIncludes = getCombinedIncludes( resourceIncludes );
+ String[] combinedIncludes = getCombinedIncludes(resourceIncludes);
List<String> resourceExcludes = resource.getExcludes();
- String[] combinedExcludes = getCombinedExcludes( resourceExcludes );
+ String[] combinedExcludes = getCombinedExcludes(resourceExcludes);
String targetPath = resource.getTargetPath();
- if ( targetPath != null )
- {
- if ( !targetPath.trim().endsWith( "/" ) )
- {
+ if (targetPath != null) {
+ if (!targetPath.trim().endsWith("/")) {
targetPath += "/";
}
- addDirectory( archiver, sourceDirectory, targetPath, combinedIncludes, combinedExcludes );
- }
- else
- {
- addDirectory( archiver, sourceDirectory, combinedIncludes, combinedExcludes );
+ addDirectory(archiver, sourceDirectory, targetPath, combinedIncludes, combinedExcludes);
+ } else {
+ addDirectory(archiver, sourceDirectory, combinedIncludes, combinedExcludes);
}
}
}
@@ -424,27 +383,25 @@ public abstract class AbstractSourceJarMojo
* @return {@link MavenArchiver}
* @throws MojoExecutionException in case of an error.
*/
- protected MavenArchiver createArchiver()
- throws MojoExecutionException
- {
+ protected MavenArchiver createArchiver() throws MojoExecutionException {
MavenArchiver archiver = new MavenArchiver();
- archiver.setArchiver( jarArchiver );
- archiver.setCreatedBy( "Maven Source Plugin", "org.apache.maven.plugins", "maven-source-plugin" );
- archiver.setBuildJdkSpecDefaultEntry( false );
+ archiver.setArchiver(jarArchiver);
+ archiver.setCreatedBy("Maven Source Plugin", "org.apache.maven.plugins", "maven-source-plugin");
+ archiver.setBuildJdkSpecDefaultEntry(false);
// configure for Reproducible Builds based on outputTimestamp value
- archiver.configureReproducibleBuild( outputTimestamp );
+ archiver.configureReproducibleBuild(outputTimestamp);
- if ( project.getBuild() != null )
- {
+ if (project.getBuild() != null) {
List<Resource> resources = project.getBuild().getResources();
- for ( Resource r : resources )
- {
- if ( r.getDirectory().endsWith( "maven-shared-archive-resources" ) )
- {
- addDirectory( archiver.getArchiver(), new File( r.getDirectory() ), getCombinedIncludes( null ),
- getCombinedExcludes( null ) );
+ for (Resource r : resources) {
+ if (r.getDirectory().endsWith("maven-shared-archive-resources")) {
+ addDirectory(
+ archiver.getArchiver(),
+ new File(r.getDirectory()),
+ getCombinedIncludes(null),
+ getCombinedExcludes(null));
}
}
}
@@ -459,18 +416,14 @@ public abstract class AbstractSourceJarMojo
* @param pExcludes The list of excludes.
* @throws MojoExecutionException in case of an error.
*/
- protected void addDirectory( Archiver archiver, File sourceDirectory, String[] pIncludes, String[] pExcludes )
- throws MojoExecutionException
- {
- try
- {
- getLog().debug( "add directory " + sourceDirectory + " to archiver" );
+ protected void addDirectory(Archiver archiver, File sourceDirectory, String[] pIncludes, String[] pExcludes)
+ throws MojoExecutionException {
+ try {
+ getLog().debug("add directory " + sourceDirectory + " to archiver");
// archiver.addFileSet( fileSet );
- archiver.addDirectory( sourceDirectory, pIncludes, pExcludes );
- }
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException( "Error adding directory to source archive.", e );
+ archiver.addDirectory(sourceDirectory, pIncludes, pExcludes);
+ } catch (ArchiverException e) {
+ throw new MojoExecutionException("Error adding directory to source archive.", e);
}
}
@@ -482,26 +435,21 @@ public abstract class AbstractSourceJarMojo
* @param pExcludes the excludes.
* @throws MojoExecutionException in case of an error.
*/
- protected void addDirectory( Archiver archiver, File sourceDirectory, String prefix, String[] pIncludes,
- String[] pExcludes )
- throws MojoExecutionException
- {
- try
- {
- getLog().debug( "add directory " + sourceDirectory + " to archiver with prefix " + prefix );
- archiver.addDirectory( sourceDirectory, prefix, pIncludes, pExcludes );
- }
- catch ( ArchiverException e )
- {
- throw new MojoExecutionException( "Error adding directory to source archive.", e );
+ protected void addDirectory(
+ Archiver archiver, File sourceDirectory, String prefix, String[] pIncludes, String[] pExcludes)
+ throws MojoExecutionException {
+ try {
+ getLog().debug("add directory " + sourceDirectory + " to archiver with prefix " + prefix);
+ archiver.addDirectory(sourceDirectory, prefix, pIncludes, pExcludes);
+ } catch (ArchiverException e) {
+ throw new MojoExecutionException("Error adding directory to source archive.", e);
}
}
/**
* @return The extension {@code .jar}
*/
- protected String getExtension()
- {
+ protected String getExtension() {
return ".jar";
}
@@ -509,10 +457,8 @@ public abstract class AbstractSourceJarMojo
* @param p {@link MavenProject}
* @return The execution projet.
*/
- protected MavenProject getProject( MavenProject p )
- {
- if ( p.getExecutionProject() != null )
- {
+ protected MavenProject getProject(MavenProject p) {
+ if (p.getExecutionProject() != null) {
return p.getExecutionProject();
}
@@ -522,8 +468,7 @@ public abstract class AbstractSourceJarMojo
/**
* @return The type {@code java-source}
*/
- protected String getType()
- {
+ protected String getType() {
return "java-source";
}
@@ -534,27 +479,23 @@ public abstract class AbstractSourceJarMojo
* @param additionalIncludes The includes specified in the pom resources section
* @return The combined array of includes.
*/
- private String[] getCombinedIncludes( List<String> additionalIncludes )
- {
+ private String[] getCombinedIncludes(List<String> additionalIncludes) {
List<String> combinedIncludes = new ArrayList<>();
- if ( includes != null && includes.length > 0 )
- {
- combinedIncludes.addAll( Arrays.asList( includes ) );
+ if (includes != null && includes.length > 0) {
+ combinedIncludes.addAll(Arrays.asList(includes));
}
- if ( additionalIncludes != null && additionalIncludes.size() > 0 )
- {
- combinedIncludes.addAll( additionalIncludes );
+ if (additionalIncludes != null && additionalIncludes.size() > 0) {
+ combinedIncludes.addAll(additionalIncludes);
}
// If there are no other includes, use the default.
- if ( combinedIncludes.size() == 0 )
- {
- combinedIncludes.addAll( Arrays.asList( DEFAULT_INCLUDES ) );
+ if (combinedIncludes.size() == 0) {
+ combinedIncludes.addAll(Arrays.asList(DEFAULT_INCLUDES));
}
- return combinedIncludes.toArray( new String[0] );
+ return combinedIncludes.toArray(new String[0]);
}
/**
@@ -564,47 +505,39 @@ public abstract class AbstractSourceJarMojo
* @param additionalExcludes Additional excludes to add to the array
* @return The combined list of excludes.
*/
-
- private String[] getCombinedExcludes( List<String> additionalExcludes )
- {
+ private String[] getCombinedExcludes(List<String> additionalExcludes) {
List<String> combinedExcludes = new ArrayList<>();
- if ( useDefaultExcludes )
- {
- combinedExcludes.addAll( FileUtils.getDefaultExcludesAsList() );
+ if (useDefaultExcludes) {
+ combinedExcludes.addAll(FileUtils.getDefaultExcludesAsList());
}
- if ( excludes != null && excludes.length > 0 )
- {
- combinedExcludes.addAll( Arrays.asList( excludes ) );
+ if (excludes != null && excludes.length > 0) {
+ combinedExcludes.addAll(Arrays.asList(excludes));
}
- if ( additionalExcludes != null && additionalExcludes.size() > 0 )
- {
- combinedExcludes.addAll( additionalExcludes );
+ if (additionalExcludes != null && additionalExcludes.size() > 0) {
+ combinedExcludes.addAll(additionalExcludes);
}
- if ( combinedExcludes.size() == 0 )
- {
- combinedExcludes.addAll( Arrays.asList( DEFAULT_EXCLUDES ) );
+ if (combinedExcludes.size() == 0) {
+ combinedExcludes.addAll(Arrays.asList(DEFAULT_EXCLUDES));
}
- return combinedExcludes.toArray( new String[0] );
+ return combinedExcludes.toArray(new String[0]);
}
/**
* @return The current project.
*/
- protected MavenProject getProject()
- {
+ protected MavenProject getProject() {
return project;
}
/**
* @param project {@link MavenProject}
*/
- protected void setProject( MavenProject project )
- {
+ protected void setProject(MavenProject project) {
this.project = project;
}
}
diff --git a/src/main/java/org/apache/maven/plugins/source/AggregatorSourceJarMojo.java b/src/main/java/org/apache/maven/plugins/source/AggregatorSourceJarMojo.java
index bb7300c..2186bad 100644
--- a/src/main/java/org/apache/maven/plugins/source/AggregatorSourceJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/AggregatorSourceJarMojo.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.source;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.source;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Execute;
@@ -29,21 +28,16 @@ import org.apache.maven.plugins.annotations.Mojo;
*
* @since 2.0.3
*/
-@Mojo( name = "aggregate", defaultPhase = LifecyclePhase.PACKAGE, aggregator = true, threadSafe = true )
-@Execute( phase = LifecyclePhase.GENERATE_SOURCES )
-public class AggregatorSourceJarMojo
- extends SourceJarMojo
-{
+@Mojo(name = "aggregate", defaultPhase = LifecyclePhase.PACKAGE, aggregator = true, threadSafe = true)
+@Execute(phase = LifecyclePhase.GENERATE_SOURCES)
+public class AggregatorSourceJarMojo extends SourceJarMojo {
/**
* {@inheritDoc}
*/
@Override
- public void execute()
- throws MojoExecutionException
- {
- if ( "pom".equals( getProject().getPackaging() ) )
- {
- packageSources( reactorProjects );
+ public void execute() throws MojoExecutionException {
+ if ("pom".equals(getProject().getPackaging())) {
+ packageSources(reactorProjects);
}
}
}
diff --git a/src/main/java/org/apache/maven/plugins/source/SourceJarMojo.java b/src/main/java/org/apache/maven/plugins/source/SourceJarMojo.java
index d645bfd..10dac7e 100644
--- a/src/main/java/org/apache/maven/plugins/source/SourceJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/SourceJarMojo.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.source;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.source;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
@@ -29,10 +28,8 @@ import org.apache.maven.plugins.annotations.Mojo;
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
* @since 2.0.3
*/
-@Mojo( name = "jar", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true )
-@Execute( phase = LifecyclePhase.GENERATE_SOURCES )
-public class SourceJarMojo
- extends SourceJarNoForkMojo
-{
+@Mojo(name = "jar", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true)
+@Execute(phase = LifecyclePhase.GENERATE_SOURCES)
+public class SourceJarMojo extends SourceJarNoForkMojo {
// no op
}
diff --git a/src/main/java/org/apache/maven/plugins/source/SourceJarNoForkMojo.java b/src/main/java/org/apache/maven/plugins/source/SourceJarNoForkMojo.java
index c96e98c..e621c74 100644
--- a/src/main/java/org/apache/maven/plugins/source/SourceJarNoForkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/SourceJarNoForkMojo.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.source;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.source;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source;
import java.util.Collections;
import java.util.List;
@@ -35,31 +34,26 @@ import org.apache.maven.project.MavenProject;
* @author pgier
* @since 2.1
*/
-@Mojo( name = "jar-no-fork", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true )
-public class SourceJarNoForkMojo
- extends AbstractSourceJarMojo
-{
+@Mojo(name = "jar-no-fork", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true)
+public class SourceJarNoForkMojo extends AbstractSourceJarMojo {
/**
* @since 2.2
*/
- @Parameter( property = "maven.source.classifier", defaultValue = "sources" )
+ @Parameter(property = "maven.source.classifier", defaultValue = "sources")
protected String classifier;
/**
* {@inheritDoc}
*/
- protected List<String> getSources( MavenProject p )
- {
+ protected List<String> getSources(MavenProject p) {
return p.getCompileSourceRoots();
}
/**
* {@inheritDoc}
*/
- protected List<Resource> getResources( MavenProject p )
- {
- if ( excludeResources )
- {
+ protected List<Resource> getResources(MavenProject p) {
+ if (excludeResources) {
return Collections.emptyList();
}
@@ -69,8 +63,7 @@ public class SourceJarNoForkMojo
/**
* {@inheritDoc}
*/
- protected String getClassifier()
- {
+ protected String getClassifier() {
return classifier;
}
}
diff --git a/src/main/java/org/apache/maven/plugins/source/TestSourceGeneratedJarMojo.java b/src/main/java/org/apache/maven/plugins/source/TestSourceGeneratedJarMojo.java
index ff6c463..b04022d 100644
--- a/src/main/java/org/apache/maven/plugins/source/TestSourceGeneratedJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/TestSourceGeneratedJarMojo.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.source;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.source;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
@@ -28,10 +27,8 @@ import org.apache.maven.plugins.annotations.Mojo;
*
* @since 2.2
*/
-@Mojo( name = "generated-test-jar", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true )
-@Execute( phase = LifecyclePhase.GENERATE_TEST_SOURCES )
-public class TestSourceGeneratedJarMojo
- extends TestSourceJarNoForkMojo
-{
+@Mojo(name = "generated-test-jar", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true)
+@Execute(phase = LifecyclePhase.GENERATE_TEST_SOURCES)
+public class TestSourceGeneratedJarMojo extends TestSourceJarNoForkMojo {
// no op
}
diff --git a/src/main/java/org/apache/maven/plugins/source/TestSourceJarMojo.java b/src/main/java/org/apache/maven/plugins/source/TestSourceJarMojo.java
index adbdd29..5e4de06 100644
--- a/src/main/java/org/apache/maven/plugins/source/TestSourceJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/TestSourceJarMojo.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.source;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.source;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
@@ -28,10 +27,8 @@ import org.apache.maven.plugins.annotations.Mojo;
*
* @since 2.0.3
*/
-@Mojo( name = "test-jar", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true )
-@Execute( phase = LifecyclePhase.GENERATE_SOURCES )
-public class TestSourceJarMojo
- extends TestSourceJarNoForkMojo
-{
+@Mojo(name = "test-jar", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true)
+@Execute(phase = LifecyclePhase.GENERATE_SOURCES)
+public class TestSourceJarMojo extends TestSourceJarNoForkMojo {
// no op
}
diff --git a/src/main/java/org/apache/maven/plugins/source/TestSourceJarNoForkMojo.java b/src/main/java/org/apache/maven/plugins/source/TestSourceJarNoForkMojo.java
index 11eb699..f9126c6 100644
--- a/src/main/java/org/apache/maven/plugins/source/TestSourceJarNoForkMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/TestSourceJarNoForkMojo.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.source;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,29 +16,11 @@ package org.apache.maven.plugins.source;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source;
import java.util.Collections;
import java.util.List;
-/*
- * 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.
- */
-
import org.apache.maven.model.Resource;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
@@ -54,31 +34,26 @@ import org.apache.maven.project.MavenProject;
*
* @since 2.1
*/
-@Mojo( name = "test-jar-no-fork", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true )
-public class TestSourceJarNoForkMojo
- extends AbstractSourceJarMojo
-{
+@Mojo(name = "test-jar-no-fork", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true)
+public class TestSourceJarNoForkMojo extends AbstractSourceJarMojo {
/**
* @since 2.2
*/
- @Parameter( property = "maven.source.test.classifier", defaultValue = "test-sources" )
+ @Parameter(property = "maven.source.test.classifier", defaultValue = "test-sources")
protected String classifier;
/**
* {@inheritDoc}
*/
- protected List<String> getSources( MavenProject p )
- {
+ protected List<String> getSources(MavenProject p) {
return p.getTestCompileSourceRoots();
}
/**
* {@inheritDoc}
*/
- protected List<Resource> getResources( MavenProject p )
- {
- if ( excludeResources )
- {
+ protected List<Resource> getResources(MavenProject p) {
+ if (excludeResources) {
return Collections.emptyList();
}
@@ -88,8 +63,7 @@ public class TestSourceJarNoForkMojo
/**
* {@inheritDoc}
*/
- protected String getClassifier()
- {
+ protected String getClassifier() {
return classifier;
}
}
diff --git a/src/test/java/org/apache/maven/plugins/source/AbstractSourcePluginTestCase.java b/src/test/java/org/apache/maven/plugins/source/AbstractSourcePluginTestCase.java
index b6db65f..19d9e99 100644
--- a/src/test/java/org/apache/maven/plugins/source/AbstractSourcePluginTestCase.java
+++ b/src/test/java/org/apache/maven/plugins/source/AbstractSourcePluginTestCase.java
@@ -1,23 +1,22 @@
-package org.apache.maven.plugins.source;
-
/*
-* 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.
-*/
+ * 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.
+ */
+package org.apache.maven.plugins.source;
import java.io.File;
import java.io.IOException;
@@ -33,9 +32,7 @@ import org.apache.maven.plugin.testing.AbstractMojoTestCase;
/**
* @author Stephane Nicoll
*/
-public abstract class AbstractSourcePluginTestCase
- extends AbstractMojoTestCase
-{
+public abstract class AbstractSourcePluginTestCase extends AbstractMojoTestCase {
protected static final String FINAL_NAME_PREFIX = "maven-source-plugin-test-";
@@ -50,16 +47,14 @@ public abstract class AbstractSourcePluginTestCase
* @param classifier The classifier.
* @throws Exception if an error occurred
*/
- protected void executeMojo( final String projectName, String classifier )
- throws Exception
- {
- File testPom = new File( getBasedir(), getTestDir( projectName ) + "/pom.xml" );
- AbstractSourceJarMojo mojo = (AbstractSourceJarMojo) lookupMojo( getGoal(), testPom );
+ protected void executeMojo(final String projectName, String classifier) throws Exception {
+ File testPom = new File(getBasedir(), getTestDir(projectName) + "/pom.xml");
+ AbstractSourceJarMojo mojo = (AbstractSourceJarMojo) lookupMojo(getGoal(), testPom);
- //Without the following line the tests will fail, cause the project.getFile() will result with null.
- mojo.getProject().setFile( testPom );
+ // Without the following line the tests will fail, cause the project.getFile() will result with null.
+ mojo.getProject().setFile(testPom);
- setVariableValueToObject( mojo, "classifier", classifier );
+ setVariableValueToObject(mojo, "classifier", classifier);
mojo.execute();
}
@@ -76,24 +71,25 @@ public abstract class AbstractSourcePluginTestCase
* @return the base directory of the project
* @throws Exception if any error occurs
*/
- protected File doTestProject( final String projectName, boolean expectSourceArchive,
- boolean expectTestSourceArchive, final String[] expectedSourceFiles,
- final String[] expectedTestSourceFiles, String classifier )
- throws Exception
- {
- executeMojo( projectName, classifier );
- final File testTargetDir = getTestTargetDir( projectName );
-
- if ( expectSourceArchive )
- {
- assertSourceArchive( testTargetDir, projectName );
- assertJarContent( getSourceArchive( testTargetDir, projectName ), expectedSourceFiles );
+ protected File doTestProject(
+ final String projectName,
+ boolean expectSourceArchive,
+ boolean expectTestSourceArchive,
+ final String[] expectedSourceFiles,
+ final String[] expectedTestSourceFiles,
+ String classifier)
+ throws Exception {
+ executeMojo(projectName, classifier);
+ final File testTargetDir = getTestTargetDir(projectName);
+
+ if (expectSourceArchive) {
+ assertSourceArchive(testTargetDir, projectName);
+ assertJarContent(getSourceArchive(testTargetDir, projectName), expectedSourceFiles);
}
- if ( expectTestSourceArchive )
- {
- assertTestSourceArchive( testTargetDir, projectName );
- assertJarContent( getTestSourceArchive( testTargetDir, projectName ), expectedTestSourceFiles );
+ if (expectTestSourceArchive) {
+ assertTestSourceArchive(testTargetDir, projectName);
+ assertJarContent(getTestSourceArchive(testTargetDir, projectName), expectedTestSourceFiles);
}
return testTargetDir;
@@ -108,11 +104,9 @@ public abstract class AbstractSourcePluginTestCase
* @return the base directory of the project
* @throws Exception if any error occurs
*/
- protected File doTestProjectWithSourceArchive( final String projectName, final String[] expectedSourceFiles,
- String classifier )
- throws Exception
- {
- return doTestProject( projectName, true, false, expectedSourceFiles, null, classifier );
+ protected File doTestProjectWithSourceArchive(
+ final String projectName, final String[] expectedSourceFiles, String classifier) throws Exception {
+ return doTestProject(projectName, true, false, expectedSourceFiles, null, classifier);
}
/**
@@ -124,89 +118,69 @@ public abstract class AbstractSourcePluginTestCase
* @return the base directory of the project
* @throws Exception if any error occurs
*/
- protected File doTestProjectWithTestSourceArchive( final String projectName, final String[] expectedTestSourceFiles,
- String classifier )
- throws Exception
- {
- return doTestProject( projectName, false, true, null, expectedTestSourceFiles, classifier );
+ protected File doTestProjectWithTestSourceArchive(
+ final String projectName, final String[] expectedTestSourceFiles, String classifier) throws Exception {
+ return doTestProject(projectName, false, true, null, expectedTestSourceFiles, classifier);
}
-
- protected void assertSourceArchive( final File testTargetDir, final String projectName )
- {
- final File expectedFile = getSourceArchive( testTargetDir, projectName );
- assertTrue( "Source archive does not exist[" + expectedFile.getAbsolutePath() + "]", expectedFile.exists() );
+ protected void assertSourceArchive(final File testTargetDir, final String projectName) {
+ final File expectedFile = getSourceArchive(testTargetDir, projectName);
+ assertTrue("Source archive does not exist[" + expectedFile.getAbsolutePath() + "]", expectedFile.exists());
}
- protected void assertTestSourceArchive( final File testTargetDir, final String projectName )
- {
- final File expectedFile = getTestSourceArchive( testTargetDir, projectName );
- assertTrue( "Test source archive does not exist[" + expectedFile.getAbsolutePath() + "]",
- expectedFile.exists() );
+ protected void assertTestSourceArchive(final File testTargetDir, final String projectName) {
+ final File expectedFile = getTestSourceArchive(testTargetDir, projectName);
+ assertTrue("Test source archive does not exist[" + expectedFile.getAbsolutePath() + "]", expectedFile.exists());
}
- protected File getSourceArchive( final File testTargetDir, final String projectName )
- {
- return new File( testTargetDir, buildFinalSourceName( projectName ) + ".jar" );
+ protected File getSourceArchive(final File testTargetDir, final String projectName) {
+ return new File(testTargetDir, buildFinalSourceName(projectName) + ".jar");
}
- protected File getTestSourceArchive( final File testTargetDir, final String projectName )
- {
- return new File( testTargetDir, buildFinalTestSourceName( projectName ) + ".jar" );
+ protected File getTestSourceArchive(final File testTargetDir, final String projectName) {
+ return new File(testTargetDir, buildFinalTestSourceName(projectName) + ".jar");
}
- protected String buildFinalSourceName( final String projectName )
- {
+ protected String buildFinalSourceName(final String projectName) {
return FINAL_NAME_PREFIX + projectName + FINAL_NAME_SUFFIX + "-sources";
}
- protected String buildFinalTestSourceName( final String projectName )
- {
+ protected String buildFinalTestSourceName(final String projectName) {
return FINAL_NAME_PREFIX + projectName + FINAL_NAME_SUFFIX + "-test-sources";
}
- protected File getTestDir( String projectName )
- throws IOException
- {
- File f = new File( "target/test-classes/unit/" + projectName );
- if ( !new File( f, "pom.xml" ).exists() )
- {
- throw new IllegalStateException( "No pom file found in " + f.getPath() );
+ protected File getTestDir(String projectName) throws IOException {
+ File f = new File("target/test-classes/unit/" + projectName);
+ if (!new File(f, "pom.xml").exists()) {
+ throw new IllegalStateException("No pom file found in " + f.getPath());
}
return f;
}
- protected void assertJarContent( final File jarFile, final String[] expectedFiles )
- throws IOException
- {
- ZipFile jar = new ZipFile( jarFile );
+ protected void assertJarContent(final File jarFile, final String[] expectedFiles) throws IOException {
+ ZipFile jar = new ZipFile(jarFile);
Enumeration<? extends ZipEntry> entries = jar.entries();
- if ( expectedFiles.length == 0 )
- {
- assertFalse( "Jar file should not contain any entry", entries.hasMoreElements() );
- }
- else
- {
- assertTrue( entries.hasMoreElements() );
+ if (expectedFiles.length == 0) {
+ assertFalse("Jar file should not contain any entry", entries.hasMoreElements());
+ } else {
+ assertTrue(entries.hasMoreElements());
- Set<String> expected = new TreeSet<>( Arrays.asList( expectedFiles ) );
+ Set<String> expected = new TreeSet<>(Arrays.asList(expectedFiles));
- while ( entries.hasMoreElements() )
- {
+ while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
- assertTrue( "Not expecting " + entry.getName() + " in " + jarFile, expected.remove( entry.getName() ) );
+ assertTrue("Not expecting " + entry.getName() + " in " + jarFile, expected.remove(entry.getName()));
}
- assertTrue( "Missing entries " + expected.toString() + " in " + jarFile, expected.isEmpty() );
+ assertTrue("Missing entries " + expected.toString() + " in " + jarFile, expected.isEmpty());
}
jar.close();
}
- protected File getTestTargetDir( String projectName )
- {
- return new File( getBasedir(), "target/test/unit/" + projectName + "/target" );
+ protected File getTestTargetDir(String projectName) {
+ return new File(getBasedir(), "target/test/unit/" + projectName + "/target");
}
}
diff --git a/src/test/java/org/apache/maven/plugins/source/SourceJarMojoTest.java b/src/test/java/org/apache/maven/plugins/source/SourceJarMojoTest.java
index 156c2dd..d585f2f 100644
--- a/src/test/java/org/apache/maven/plugins/source/SourceJarMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/source/SourceJarMojoTest.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.source;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,26 +16,23 @@ package org.apache.maven.plugins.source;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source;
import java.io.File;
/**
* @author <a href="mailto:oching@exist.com">Maria Odea Ching</a>
*/
-public class SourceJarMojoTest
- extends AbstractSourcePluginTestCase
-{
- protected String getGoal()
- {
+public class SourceJarMojoTest extends AbstractSourcePluginTestCase {
+ protected String getGoal() {
return "jar";
}
- private String[] addMavenDescriptor( String project, String[] listOfElements )
- {
+ private String[] addMavenDescriptor(String project, String[] listOfElements) {
final String METAINF = "META-INF/";
final String MAVENSOURCE = "maven/source/maven-source-plugin-test-";
String[] result = new String[listOfElements.length + 5];
- System.arraycopy( listOfElements, 0, result, 0, listOfElements.length );
+ System.arraycopy(listOfElements, 0, result, 0, listOfElements.length);
result[listOfElements.length] = METAINF + "maven/";
result[listOfElements.length + 1] = METAINF + "maven/source/";
result[listOfElements.length + 2] = METAINF + MAVENSOURCE + project + "/";
@@ -46,65 +41,84 @@ public class SourceJarMojoTest
return result;
}
- public void testDefaultConfiguration()
- throws Exception
- {
- doTestProjectWithSourceArchive( "project-001",
- addMavenDescriptor( "project-001",
- new String[] { "default-configuration.properties",
- "foo/project001/App.java", "foo/project001/", "foo/",
- "META-INF/MANIFEST.MF", "META-INF/" } ),
- "sources" );
+ public void testDefaultConfiguration() throws Exception {
+ doTestProjectWithSourceArchive(
+ "project-001",
+ addMavenDescriptor("project-001", new String[] {
+ "default-configuration.properties",
+ "foo/project001/App.java",
+ "foo/project001/",
+ "foo/",
+ "META-INF/MANIFEST.MF",
+ "META-INF/"
+ }),
+ "sources");
}
- public void testExcludes()
- throws Exception
- {
- doTestProjectWithSourceArchive( "project-003",
- addMavenDescriptor( "project-003",
- new String[] { "default-configuration.properties",
- "foo/project003/App.java", "foo/project003/", "foo/",
- "META-INF/MANIFEST.MF", "META-INF/" } ),
- "sources" );
+ public void testExcludes() throws Exception {
+ doTestProjectWithSourceArchive(
+ "project-003",
+ addMavenDescriptor("project-003", new String[] {
+ "default-configuration.properties",
+ "foo/project003/App.java",
+ "foo/project003/",
+ "foo/",
+ "META-INF/MANIFEST.MF",
+ "META-INF/"
+ }),
+ "sources");
}
- public void testNoSources()
- throws Exception
- {
- executeMojo( "project-005", "sources" );
+ public void testNoSources() throws Exception {
+ executeMojo("project-005", "sources");
// Now make sure that no archive got created
- final File expectedFile = getTestTargetDir( "project-005" );
- assertFalse( "Source archive should not have been created[" + expectedFile.getAbsolutePath() + "]",
- expectedFile.exists() );
+ final File expectedFile = getTestTargetDir("project-005");
+ assertFalse(
+ "Source archive should not have been created[" + expectedFile.getAbsolutePath() + "]",
+ expectedFile.exists());
}
- public void testIncludes()
- throws Exception
- {
- doTestProjectWithSourceArchive( "project-007", addMavenDescriptor( "project-007", new String[] {
- "templates/configuration-template.properties", "foo/project007/App.java", "templates/", "foo/project007/",
- "foo/", "META-INF/MANIFEST.MF", "META-INF/" } ), "sources" );
+ public void testIncludes() throws Exception {
+ doTestProjectWithSourceArchive(
+ "project-007",
+ addMavenDescriptor("project-007", new String[] {
+ "templates/configuration-template.properties",
+ "foo/project007/App.java",
+ "templates/",
+ "foo/project007/",
+ "foo/",
+ "META-INF/MANIFEST.MF",
+ "META-INF/"
+ }),
+ "sources");
}
- public void testIncludePom()
- throws Exception
- {
- doTestProjectWithSourceArchive( "project-009",
- addMavenDescriptor( "project-009",
- new String[] { "default-configuration.properties",
- "pom.xml", "foo/project009/App.java", "foo/project009/",
- "foo/", "META-INF/MANIFEST.MF", "META-INF/" } ),
- "sources" );
+ public void testIncludePom() throws Exception {
+ doTestProjectWithSourceArchive(
+ "project-009",
+ addMavenDescriptor("project-009", new String[] {
+ "default-configuration.properties",
+ "pom.xml",
+ "foo/project009/App.java",
+ "foo/project009/",
+ "foo/",
+ "META-INF/MANIFEST.MF",
+ "META-INF/"
+ }),
+ "sources");
}
- public void testIncludeMavenDescriptorWhenExplicitlyConfigured()
- throws Exception
- {
- doTestProjectWithSourceArchive( "project-010",
- addMavenDescriptor( "project-010",
- new String[] { "default-configuration.properties",
- "foo/project010/App.java", "foo/project010/", "foo/",
- "META-INF/MANIFEST.MF", "META-INF/" } ),
- "sources" );
+ public void testIncludeMavenDescriptorWhenExplicitlyConfigured() throws Exception {
+ doTestProjectWithSourceArchive(
+ "project-010",
+ addMavenDescriptor("project-010", new String[] {
+ "default-configuration.properties",
+ "foo/project010/App.java",
+ "foo/project010/",
+ "foo/",
+ "META-INF/MANIFEST.MF",
+ "META-INF/"
+ }),
+ "sources");
}
}
diff --git a/src/test/java/org/apache/maven/plugins/source/TestSourceJarMojoTest.java b/src/test/java/org/apache/maven/plugins/source/TestSourceJarMojoTest.java
index c7231ec..bcb7b34 100644
--- a/src/test/java/org/apache/maven/plugins/source/TestSourceJarMojoTest.java
+++ b/src/test/java/org/apache/maven/plugins/source/TestSourceJarMojoTest.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.source;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,60 +16,83 @@ package org.apache.maven.plugins.source;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source;
import java.io.File;
/**
* @author <a href="mailto:oching@exist.com">Maria Odea Ching</a>
*/
-public class TestSourceJarMojoTest
- extends AbstractSourcePluginTestCase
-{
+public class TestSourceJarMojoTest extends AbstractSourcePluginTestCase {
- protected String getGoal()
- {
+ protected String getGoal() {
return "test-jar";
}
- public void testDefaultConfiguration()
- throws Exception
- {
- doTestProjectWithTestSourceArchive( "project-001", new String[] { "test-default-configuration.properties",
- "foo/project001/AppTest.java", "foo/project001/", "foo/", "META-INF/MANIFEST.MF", "META-INF/",
- "META-INF/maven/", "META-INF/maven/source/", "META-INF/maven/source/maven-source-plugin-test-project-001/",
- "META-INF/maven/source/maven-source-plugin-test-project-001/pom.properties",
- "META-INF/maven/source/maven-source-plugin-test-project-001/pom.xml" }, "test-sources" );
+ public void testDefaultConfiguration() throws Exception {
+ doTestProjectWithTestSourceArchive(
+ "project-001",
+ new String[] {
+ "test-default-configuration.properties",
+ "foo/project001/AppTest.java",
+ "foo/project001/",
+ "foo/",
+ "META-INF/MANIFEST.MF",
+ "META-INF/",
+ "META-INF/maven/",
+ "META-INF/maven/source/",
+ "META-INF/maven/source/maven-source-plugin-test-project-001/",
+ "META-INF/maven/source/maven-source-plugin-test-project-001/pom.properties",
+ "META-INF/maven/source/maven-source-plugin-test-project-001/pom.xml"
+ },
+ "test-sources");
}
- public void testExcludes()
- throws Exception
- {
- doTestProjectWithTestSourceArchive( "project-003", new String[] { "test-default-configuration.properties",
- "foo/project003/AppTest.java", "foo/project003/", "foo/", "META-INF/MANIFEST.MF", "META-INF/",
- "META-INF/maven/", "META-INF/maven/source/", "META-INF/maven/source/maven-source-plugin-test-project-003/",
- "META-INF/maven/source/maven-source-plugin-test-project-003/pom.properties",
- "META-INF/maven/source/maven-source-plugin-test-project-003/pom.xml" }, "test-sources" );
+ public void testExcludes() throws Exception {
+ doTestProjectWithTestSourceArchive(
+ "project-003",
+ new String[] {
+ "test-default-configuration.properties",
+ "foo/project003/AppTest.java",
+ "foo/project003/",
+ "foo/",
+ "META-INF/MANIFEST.MF",
+ "META-INF/",
+ "META-INF/maven/",
+ "META-INF/maven/source/",
+ "META-INF/maven/source/maven-source-plugin-test-project-003/",
+ "META-INF/maven/source/maven-source-plugin-test-project-003/pom.properties",
+ "META-INF/maven/source/maven-source-plugin-test-project-003/pom.xml"
+ },
+ "test-sources");
}
- public void testNoSources()
- throws Exception
- {
- executeMojo( "project-005", "test-sources" );
+ public void testNoSources() throws Exception {
+ executeMojo("project-005", "test-sources");
// Now make sure that no archive got created
- final File expectedFile = getTestTargetDir( "project-005" );
- assertFalse( "Test source archive should not have been created[" + expectedFile.getAbsolutePath() + "]",
- expectedFile.exists() );
+ final File expectedFile = getTestTargetDir("project-005");
+ assertFalse(
+ "Test source archive should not have been created[" + expectedFile.getAbsolutePath() + "]",
+ expectedFile.exists());
}
- public void testIncludeMavenDescriptorWhenExplicitlyConfigured()
- throws Exception
- {
- doTestProjectWithTestSourceArchive( "project-010", new String[] { "test-default-configuration.properties",
- "foo/project010/AppTest.java", "foo/project010/", "foo/", "META-INF/MANIFEST.MF", "META-INF/",
- "META-INF/maven/", "META-INF/maven/source/", "META-INF/maven/source/maven-source-plugin-test-project-010/",
- "META-INF/maven/source/maven-source-plugin-test-project-010/pom.xml",
- "META-INF/maven/source/maven-source-plugin-test-project-010/pom" + ".properties" }, "test-sources" );
+ public void testIncludeMavenDescriptorWhenExplicitlyConfigured() throws Exception {
+ doTestProjectWithTestSourceArchive(
+ "project-010",
+ new String[] {
+ "test-default-configuration.properties",
+ "foo/project010/AppTest.java",
+ "foo/project010/",
+ "foo/",
+ "META-INF/MANIFEST.MF",
+ "META-INF/",
+ "META-INF/maven/",
+ "META-INF/maven/source/",
+ "META-INF/maven/source/maven-source-plugin-test-project-010/",
+ "META-INF/maven/source/maven-source-plugin-test-project-010/pom.xml",
+ "META-INF/maven/source/maven-source-plugin-test-project-010/pom" + ".properties"
+ },
+ "test-sources");
}
-
}
diff --git a/src/test/java/org/apache/maven/plugins/source/stubs/DefaultArtifactHandlerStub.java b/src/test/java/org/apache/maven/plugins/source/stubs/DefaultArtifactHandlerStub.java
index 324dc91..506f23a 100755
--- a/src/test/java/org/apache/maven/plugins/source/stubs/DefaultArtifactHandlerStub.java
+++ b/src/test/java/org/apache/maven/plugins/source/stubs/DefaultArtifactHandlerStub.java
@@ -1,3 +1,21 @@
+/*
+ * 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.
+ */
package org.apache.maven.plugins.source.stubs;
/*
@@ -24,23 +42,18 @@ import org.apache.maven.artifact.handler.DefaultArtifactHandler;
/**
* @author pgier
*/
-public class DefaultArtifactHandlerStub
- extends DefaultArtifactHandler
-{
+public class DefaultArtifactHandlerStub extends DefaultArtifactHandler {
private String language;
- public String getLanguage()
- {
- if ( language == null )
- {
+ public String getLanguage() {
+ if (language == null) {
language = "java";
}
return language;
}
- public void setLanguage( String language )
- {
+ public void setLanguage(String language) {
this.language = language;
}
}
diff --git a/src/test/java/org/apache/maven/plugins/source/stubs/Project001Stub.java b/src/test/java/org/apache/maven/plugins/source/stubs/Project001Stub.java
index 98070aa..773eeb9 100644
--- a/src/test/java/org/apache/maven/plugins/source/stubs/Project001Stub.java
+++ b/src/test/java/org/apache/maven/plugins/source/stubs/Project001Stub.java
@@ -1,20 +1,3 @@
-package org.apache.maven.plugins.source.stubs;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.maven.model.Build;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Resource;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.ReaderFactory;
-import org.codehaus.plexus.util.xml.XmlStreamReader;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -33,113 +16,111 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source.stubs;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Resource;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.xml.XmlStreamReader;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
/**
* @author <a href="mailto:oching@exist.com">Maria Odea Ching</a>
*/
-public class Project001Stub
- extends MavenProjectStub
-{
+public class Project001Stub extends MavenProjectStub {
private Build build;
private List<Resource> resources;
private List<Resource> testResources;
- public Project001Stub()
- {
+ public Project001Stub() {
Model model;
- try
- {
- model = readModelFromFile( new File( getBasedir(), "target/test-classes/unit/project-001/pom.xml" ) );
- setModel( model );
+ try {
+ model = readModelFromFile(new File(getBasedir(), "target/test-classes/unit/project-001/pom.xml"));
+ setModel(model);
- setGroupId( model.getGroupId() );
- setArtifactId( model.getArtifactId() );
- setVersion( model.getVersion() );
- setName( model.getName() );
- setUrl( model.getUrl() );
- setPackaging( model.getPackaging() );
+ setGroupId(model.getGroupId());
+ setArtifactId(model.getArtifactId());
+ setVersion(model.getVersion());
+ setName(model.getName());
+ setUrl(model.getUrl());
+ setPackaging(model.getPackaging());
Build build = new Build();
- build.setFinalName( getArtifactId() + "-" + getVersion() );
- build.setDirectory( getBasedir() + "/target/test/unit/project-001/target" );
- setBuild( build );
+ build.setFinalName(getArtifactId() + "-" + getVersion());
+ build.setDirectory(getBasedir() + "/target/test/unit/project-001/target");
+ setBuild(build);
String basedir = getBasedir().getAbsolutePath();
List<String> compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add( basedir + "/target/test-classes/unit/project-001/src/main/java" );
- setCompileSourceRoots( compileSourceRoots );
+ compileSourceRoots.add(basedir + "/target/test-classes/unit/project-001/src/main/java");
+ setCompileSourceRoots(compileSourceRoots);
List<String> testCompileSourceRoots = new ArrayList<>();
- testCompileSourceRoots.add( basedir + "/target/test-classes/unit/project-001/src/test/java" );
- setTestCompileSourceRoots( testCompileSourceRoots );
+ testCompileSourceRoots.add(basedir + "/target/test-classes/unit/project-001/src/test/java");
+ setTestCompileSourceRoots(testCompileSourceRoots);
- setResources( model.getBuild().getResources() );
- setTestResources( model.getBuild().getTestResources() );
+ setResources(model.getBuild().getResources());
+ setTestResources(model.getBuild().getTestResources());
SourcePluginArtifactStub artifact =
- new SourcePluginArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging(), null );
- artifact.setArtifactHandler( new DefaultArtifactHandlerStub() );
- artifact.setType( "jar" );
- artifact.setBaseVersion( "1.0-SNAPSHOT" );
- setArtifact( artifact );
+ new SourcePluginArtifactStub(getGroupId(), getArtifactId(), getVersion(), getPackaging(), null);
+ artifact.setArtifactHandler(new DefaultArtifactHandlerStub());
+ artifact.setType("jar");
+ artifact.setBaseVersion("1.0-SNAPSHOT");
+ setArtifact(artifact);
- }
- catch ( Exception e )
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
- public Build getBuild()
- {
+ public Build getBuild() {
return build;
}
- public void setBuild( Build build )
- {
+ public void setBuild(Build build) {
this.build = build;
}
- public List<Resource> getResources()
- {
+ public List<Resource> getResources() {
return this.resources;
}
- public void setResources( List<Resource> resources )
- {
+ public void setResources(List<Resource> resources) {
this.resources = resources;
}
- public List<Resource> getTestResources()
- {
+ public List<Resource> getTestResources() {
return testResources;
}
- public void setTestResources( List<Resource> testResources )
- {
+ public void setTestResources(List<Resource> testResources) {
this.testResources = testResources;
}
- static Model readModelFromFile( File file )
- throws IOException, XmlPullParserException
- {
+ static Model readModelFromFile(File file) throws IOException, XmlPullParserException {
MavenXpp3Reader pomReader = new MavenXpp3Reader();
XmlStreamReader reader = null;
- try
- {
- reader = ReaderFactory.newXmlReader( file );
- final Model model = pomReader.read( reader );
+ try {
+ reader = ReaderFactory.newXmlReader(file);
+ final Model model = pomReader.read(reader);
reader.close();
reader = null;
return model;
+ } finally {
+ IOUtil.close(reader);
}
- finally
- {
- IOUtil.close( reader );
- }
-
}
}
diff --git a/src/test/java/org/apache/maven/plugins/source/stubs/Project003Stub.java b/src/test/java/org/apache/maven/plugins/source/stubs/Project003Stub.java
index 6931565..c010351 100644
--- a/src/test/java/org/apache/maven/plugins/source/stubs/Project003Stub.java
+++ b/src/test/java/org/apache/maven/plugins/source/stubs/Project003Stub.java
@@ -1,15 +1,3 @@
-package org.apache.maven.plugins.source.stubs;
-
-import static org.apache.maven.plugins.source.stubs.Project001Stub.readModelFromFile;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.maven.model.Build;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Resource;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -28,96 +16,93 @@ import org.apache.maven.model.Resource;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source.stubs;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Resource;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import static org.apache.maven.plugins.source.stubs.Project001Stub.readModelFromFile;
+
/**
* @author <a href="mailto:oching@exist.com">Maria Odea Ching</a>
*/
-public class Project003Stub
- extends MavenProjectStub
-{
+public class Project003Stub extends MavenProjectStub {
private Build build;
private List<Resource> resources;
private List<Resource> testResources;
- public Project003Stub()
- {
+ public Project003Stub() {
Model model;
- try
- {
- model = readModelFromFile( new File( getBasedir(), "target/test-classes/unit/project-003/pom.xml" ) );
- setModel( model );
+ try {
+ model = readModelFromFile(new File(getBasedir(), "target/test-classes/unit/project-003/pom.xml"));
+ setModel(model);
- setGroupId( model.getGroupId() );
- setArtifactId( model.getArtifactId() );
- setVersion( model.getVersion() );
- setName( model.getName() );
- setUrl( model.getUrl() );
- setPackaging( model.getPackaging() );
+ setGroupId(model.getGroupId());
+ setArtifactId(model.getArtifactId());
+ setVersion(model.getVersion());
+ setName(model.getName());
+ setUrl(model.getUrl());
+ setPackaging(model.getPackaging());
Build build = new Build();
- build.setFinalName( getArtifactId() + "-" + getVersion() );
- build.setDirectory( getBasedir() + "/target/test/unit/project-003/target" );
- setBuild( build );
+ build.setFinalName(getArtifactId() + "-" + getVersion());
+ build.setDirectory(getBasedir() + "/target/test/unit/project-003/target");
+ setBuild(build);
String basedir = getBasedir().getAbsolutePath();
List<String> compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add( basedir + "/target/test-classes/unit/project-003/src/main/java" );
- setCompileSourceRoots( compileSourceRoots );
+ compileSourceRoots.add(basedir + "/target/test-classes/unit/project-003/src/main/java");
+ setCompileSourceRoots(compileSourceRoots);
List<String> testCompileSourceRoots = new ArrayList<>();
- testCompileSourceRoots.add( basedir + "/target/test-classes/unit/project-003/src/test/java" );
- setTestCompileSourceRoots( testCompileSourceRoots );
+ testCompileSourceRoots.add(basedir + "/target/test-classes/unit/project-003/src/test/java");
+ setTestCompileSourceRoots(testCompileSourceRoots);
- setResources( model.getBuild().getResources() );
- setTestResources( model.getBuild().getTestResources() );
+ setResources(model.getBuild().getResources());
+ setTestResources(model.getBuild().getTestResources());
SourcePluginArtifactStub artifact =
- new SourcePluginArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging(), null );
- artifact.setArtifactHandler( new DefaultArtifactHandlerStub() );
- artifact.setType( "jar" );
- artifact.setBaseVersion( "1.0-SNAPSHOT" );
- setArtifact( artifact );
+ new SourcePluginArtifactStub(getGroupId(), getArtifactId(), getVersion(), getPackaging(), null);
+ artifact.setArtifactHandler(new DefaultArtifactHandlerStub());
+ artifact.setType("jar");
+ artifact.setBaseVersion("1.0-SNAPSHOT");
+ setArtifact(artifact);
- }
- catch ( Exception e )
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
- public Build getBuild()
- {
+ public Build getBuild() {
return build;
}
- public void setBuild( Build build )
- {
+ public void setBuild(Build build) {
this.build = build;
}
- public List<Resource> getResources()
- {
+ public List<Resource> getResources() {
return resources;
}
- public void setResources( List<Resource> resources )
- {
+ public void setResources(List<Resource> resources) {
this.resources = resources;
}
- public List<Resource> getTestResources()
- {
+ public List<Resource> getTestResources() {
return testResources;
}
- public void setTestResources( List<Resource> testResources )
- {
+ public void setTestResources(List<Resource> testResources) {
this.testResources = testResources;
}
-
}
diff --git a/src/test/java/org/apache/maven/plugins/source/stubs/Project005Stub.java b/src/test/java/org/apache/maven/plugins/source/stubs/Project005Stub.java
index 7e96d13..ee00cf6 100644
--- a/src/test/java/org/apache/maven/plugins/source/stubs/Project005Stub.java
+++ b/src/test/java/org/apache/maven/plugins/source/stubs/Project005Stub.java
@@ -1,14 +1,3 @@
-package org.apache.maven.plugins.source.stubs;
-
-import static org.apache.maven.plugins.source.stubs.Project001Stub.readModelFromFile;
-
-import java.io.File;
-import java.util.List;
-
-import org.apache.maven.model.Build;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Resource;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -27,83 +16,79 @@ import org.apache.maven.model.Resource;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source.stubs;
+import java.io.File;
+import java.util.List;
+
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Resource;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import static org.apache.maven.plugins.source.stubs.Project001Stub.readModelFromFile;
+
/**
* @author <a href="mailto:oching@exist.com">Maria Odea Ching</a>
*/
-public class Project005Stub
- extends MavenProjectStub
-{
+public class Project005Stub extends MavenProjectStub {
private Build build;
private List<Resource> resources;
private List<Resource> testResources;
- public Project005Stub()
- {
+ public Project005Stub() {
Model model;
- try
- {
- model = readModelFromFile( new File( getBasedir(), "target/test-classes/unit/project-005/pom.xml" ) );
- setModel( model );
-
- setGroupId( model.getGroupId() );
- setArtifactId( model.getArtifactId() );
- setVersion( model.getVersion() );
- setName( model.getName() );
- setUrl( model.getUrl() );
- setPackaging( model.getPackaging() );
+ try {
+ model = readModelFromFile(new File(getBasedir(), "target/test-classes/unit/project-005/pom.xml"));
+ setModel(model);
+
+ setGroupId(model.getGroupId());
+ setArtifactId(model.getArtifactId());
+ setVersion(model.getVersion());
+ setName(model.getName());
+ setUrl(model.getUrl());
+ setPackaging(model.getPackaging());
Build build = new Build();
- build.setFinalName( getArtifactId() + "-" + getVersion() );
- build.setDirectory( getBasedir() + "/target/test/unit/project-005/target" );
- setBuild( build );
+ build.setFinalName(getArtifactId() + "-" + getVersion());
+ build.setDirectory(getBasedir() + "/target/test/unit/project-005/target");
+ setBuild(build);
SourcePluginArtifactStub artifact =
- new SourcePluginArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging(), null );
- artifact.setArtifactHandler( new DefaultArtifactHandlerStub() );
- artifact.setType( "jar" );
- artifact.setBaseVersion( "1.0-SNAPSHOT" );
- setArtifact( artifact );
+ new SourcePluginArtifactStub(getGroupId(), getArtifactId(), getVersion(), getPackaging(), null);
+ artifact.setArtifactHandler(new DefaultArtifactHandlerStub());
+ artifact.setType("jar");
+ artifact.setBaseVersion("1.0-SNAPSHOT");
+ setArtifact(artifact);
- }
- catch ( Exception e )
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
- public Build getBuild()
- {
+ public Build getBuild() {
return build;
}
- public void setBuild( Build build )
- {
+ public void setBuild(Build build) {
this.build = build;
}
- public List<Resource> getResources()
- {
+ public List<Resource> getResources() {
return resources;
}
- public void setResources( List<Resource> resources )
- {
+ public void setResources(List<Resource> resources) {
this.resources = resources;
}
- public List<Resource> getTestResources()
- {
+ public List<Resource> getTestResources() {
return testResources;
}
- public void setTestResources( List<Resource> testResources )
- {
+ public void setTestResources(List<Resource> testResources) {
this.testResources = testResources;
}
-
}
diff --git a/src/test/java/org/apache/maven/plugins/source/stubs/Project007Stub.java b/src/test/java/org/apache/maven/plugins/source/stubs/Project007Stub.java
index 454dbb7..120cc5b 100644
--- a/src/test/java/org/apache/maven/plugins/source/stubs/Project007Stub.java
+++ b/src/test/java/org/apache/maven/plugins/source/stubs/Project007Stub.java
@@ -1,15 +1,3 @@
-package org.apache.maven.plugins.source.stubs;
-
-import static org.apache.maven.plugins.source.stubs.Project001Stub.readModelFromFile;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.maven.model.Build;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Resource;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -28,94 +16,92 @@ import org.apache.maven.model.Resource;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source.stubs;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Resource;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import static org.apache.maven.plugins.source.stubs.Project001Stub.readModelFromFile;
+
/**
* @author <a href="mailto:oching@exist.com">Maria Odea Ching</a>
*/
-public class Project007Stub
- extends MavenProjectStub
-{
+public class Project007Stub extends MavenProjectStub {
private Build build;
private List<Resource> resources;
private List<Resource> testResources;
- public Project007Stub()
- {
+ public Project007Stub() {
Model model;
- try
- {
- model = readModelFromFile( new File( getBasedir(), "target/test-classes/unit/project-007/pom.xml" ) );
- setModel( model );
-
- setGroupId( model.getGroupId() );
- setArtifactId( model.getArtifactId() );
- setVersion( model.getVersion() );
- setName( model.getName() );
- setUrl( model.getUrl() );
- setPackaging( model.getPackaging() );
+ try {
+ model = readModelFromFile(new File(getBasedir(), "target/test-classes/unit/project-007/pom.xml"));
+ setModel(model);
+
+ setGroupId(model.getGroupId());
+ setArtifactId(model.getArtifactId());
+ setVersion(model.getVersion());
+ setName(model.getName());
+ setUrl(model.getUrl());
+ setPackaging(model.getPackaging());
Build build = new Build();
- build.setFinalName( getArtifactId() + "-" + getVersion() );
- build.setDirectory( getBasedir() + "/target/test/unit/project-007/target" );
- setBuild( build );
+ build.setFinalName(getArtifactId() + "-" + getVersion());
+ build.setDirectory(getBasedir() + "/target/test/unit/project-007/target");
+ setBuild(build);
String basedir = getBasedir().getAbsolutePath();
List<String> compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add( basedir + "/target/test-classes/unit/project-007/src/main/java" );
- setCompileSourceRoots( compileSourceRoots );
+ compileSourceRoots.add(basedir + "/target/test-classes/unit/project-007/src/main/java");
+ setCompileSourceRoots(compileSourceRoots);
List<String> testCompileSourceRoots = new ArrayList<>();
- testCompileSourceRoots.add( basedir + "/target/test-classes/unit/project-007/src/test/java" );
- setTestCompileSourceRoots( testCompileSourceRoots );
+ testCompileSourceRoots.add(basedir + "/target/test-classes/unit/project-007/src/test/java");
+ setTestCompileSourceRoots(testCompileSourceRoots);
- setResources( model.getBuild().getResources() );
- setTestResources( model.getBuild().getTestResources() );
+ setResources(model.getBuild().getResources());
+ setTestResources(model.getBuild().getTestResources());
SourcePluginArtifactStub artifact =
- new SourcePluginArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging(), null );
- artifact.setArtifactHandler( new DefaultArtifactHandlerStub() );
- artifact.setType( "jar" );
- artifact.setBaseVersion( "1.0-SNAPSHOT" );
- setArtifact( artifact );
+ new SourcePluginArtifactStub(getGroupId(), getArtifactId(), getVersion(), getPackaging(), null);
+ artifact.setArtifactHandler(new DefaultArtifactHandlerStub());
+ artifact.setType("jar");
+ artifact.setBaseVersion("1.0-SNAPSHOT");
+ setArtifact(artifact);
- }
- catch ( Exception e )
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
- public Build getBuild()
- {
+ public Build getBuild() {
return build;
}
- public void setBuild( Build build )
- {
+ public void setBuild(Build build) {
this.build = build;
}
- public List<Resource> getResources()
- {
+ public List<Resource> getResources() {
return resources;
}
- public void setResources( List<Resource> resources )
- {
+ public void setResources(List<Resource> resources) {
this.resources = resources;
}
- public List<Resource> getTestResources()
- {
+ public List<Resource> getTestResources() {
return testResources;
}
- public void setTestResources( List<Resource> testResources )
- {
+ public void setTestResources(List<Resource> testResources) {
this.testResources = testResources;
}
}
diff --git a/src/test/java/org/apache/maven/plugins/source/stubs/Project009Stub.java b/src/test/java/org/apache/maven/plugins/source/stubs/Project009Stub.java
index d543bd0..3955a2e 100644
--- a/src/test/java/org/apache/maven/plugins/source/stubs/Project009Stub.java
+++ b/src/test/java/org/apache/maven/plugins/source/stubs/Project009Stub.java
@@ -1,11 +1,3 @@
-package org.apache.maven.plugins.source.stubs;
-
-import static org.apache.maven.plugins.source.stubs.Project001Stub.readModelFromFile;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24,99 +16,94 @@ import java.util.List;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source.stubs;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import static org.apache.maven.plugins.source.stubs.Project001Stub.readModelFromFile;
+
/**
* @author Dennis Lundberg
*/
-public class Project009Stub
- extends MavenProjectStub
-{
+public class Project009Stub extends MavenProjectStub {
private Build build;
private List<Resource> resources;
private List<Resource> testResources;
- public Project009Stub()
- {
+ public Project009Stub() {
Model model;
- try
- {
- final File pomFile = new File( getBasedir(), "target/test-classes/unit/project-009/pom.xml" );
- model = readModelFromFile( pomFile );
- setModel( model );
- setFile( pomFile );
+ try {
+ final File pomFile = new File(getBasedir(), "target/test-classes/unit/project-009/pom.xml");
+ model = readModelFromFile(pomFile);
+ setModel(model);
+ setFile(pomFile);
- setGroupId( model.getGroupId() );
- setArtifactId( model.getArtifactId() );
- setVersion( model.getVersion() );
- setName( model.getName() );
- setUrl( model.getUrl() );
- setPackaging( model.getPackaging() );
+ setGroupId(model.getGroupId());
+ setArtifactId(model.getArtifactId());
+ setVersion(model.getVersion());
+ setName(model.getName());
+ setUrl(model.getUrl());
+ setPackaging(model.getPackaging());
Build build = new Build();
- build.setFinalName( getArtifactId() + "-" + getVersion() );
- build.setDirectory( getBasedir() + "/target/test/unit/project-009/target" );
- setBuild( build );
+ build.setFinalName(getArtifactId() + "-" + getVersion());
+ build.setDirectory(getBasedir() + "/target/test/unit/project-009/target");
+ setBuild(build);
String basedir = getBasedir().getAbsolutePath();
List<String> compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add( basedir + "/target/test-classes/unit/project-009/src/main/java" );
- setCompileSourceRoots( compileSourceRoots );
+ compileSourceRoots.add(basedir + "/target/test-classes/unit/project-009/src/main/java");
+ setCompileSourceRoots(compileSourceRoots);
List<String> testCompileSourceRoots = new ArrayList<>();
- testCompileSourceRoots.add( basedir + "/target/test-classes/unit/project-009/src/test/java" );
- setTestCompileSourceRoots( testCompileSourceRoots );
+ testCompileSourceRoots.add(basedir + "/target/test-classes/unit/project-009/src/test/java");
+ setTestCompileSourceRoots(testCompileSourceRoots);
- setResources( model.getBuild().getResources() );
- setTestResources( model.getBuild().getTestResources() );
+ setResources(model.getBuild().getResources());
+ setTestResources(model.getBuild().getTestResources());
SourcePluginArtifactStub artifact =
- new SourcePluginArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging(), null );
- artifact.setArtifactHandler( new DefaultArtifactHandlerStub() );
- artifact.setType( "jar" );
- artifact.setBaseVersion( "1.0-SNAPSHOT" );
- setArtifact( artifact );
- }
- catch ( Exception e )
- {
+ new SourcePluginArtifactStub(getGroupId(), getArtifactId(), getVersion(), getPackaging(), null);
+ artifact.setArtifactHandler(new DefaultArtifactHandlerStub());
+ artifact.setType("jar");
+ artifact.setBaseVersion("1.0-SNAPSHOT");
+ setArtifact(artifact);
+ } catch (Exception e) {
e.printStackTrace();
}
}
- public Build getBuild()
- {
+ public Build getBuild() {
return build;
}
- public void setBuild( Build build )
- {
+ public void setBuild(Build build) {
this.build = build;
}
- public List<Resource> getResources()
- {
+ public List<Resource> getResources() {
return resources;
}
- public void setResources( List<Resource> resources )
- {
+ public void setResources(List<Resource> resources) {
this.resources = resources;
}
- public List<Resource> getTestResources()
- {
+ public List<Resource> getTestResources() {
return testResources;
}
- public void setTestResources( List<Resource> testResources )
- {
+ public void setTestResources(List<Resource> testResources) {
this.testResources = testResources;
}
}
diff --git a/src/test/java/org/apache/maven/plugins/source/stubs/Project010Stub.java b/src/test/java/org/apache/maven/plugins/source/stubs/Project010Stub.java
index 7f9b39c..90a5a4a 100644
--- a/src/test/java/org/apache/maven/plugins/source/stubs/Project010Stub.java
+++ b/src/test/java/org/apache/maven/plugins/source/stubs/Project010Stub.java
@@ -1,11 +1,3 @@
-package org.apache.maven.plugins.source.stubs;
-
-import static org.apache.maven.plugins.source.stubs.Project001Stub.readModelFromFile;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -24,98 +16,93 @@ import java.util.List;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source.stubs;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
import org.apache.maven.model.Build;
import org.apache.maven.model.Model;
import org.apache.maven.model.Resource;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-public class Project010Stub
- extends MavenProjectStub
-{
+import static org.apache.maven.plugins.source.stubs.Project001Stub.readModelFromFile;
+
+public class Project010Stub extends MavenProjectStub {
private Build build;
private List<Resource> resources;
private List<Resource> testResources;
- public Project010Stub()
- {
+ public Project010Stub() {
Model model;
- try
- {
- model = readModelFromFile( new File( getBasedir(), "target/test-classes/unit/project-010/pom.xml" ) );
- setModel( model );
+ try {
+ model = readModelFromFile(new File(getBasedir(), "target/test-classes/unit/project-010/pom.xml"));
+ setModel(model);
- setFile( new File( getBasedir(), "target/test-classes/unit/project-010/pom.xml" ) );
+ setFile(new File(getBasedir(), "target/test-classes/unit/project-010/pom.xml"));
- setGroupId( model.getGroupId() );
- setArtifactId( model.getArtifactId() );
- setVersion( model.getVersion() );
- setName( model.getName() );
- setUrl( model.getUrl() );
- setPackaging( model.getPackaging() );
+ setGroupId(model.getGroupId());
+ setArtifactId(model.getArtifactId());
+ setVersion(model.getVersion());
+ setName(model.getName());
+ setUrl(model.getUrl());
+ setPackaging(model.getPackaging());
Build build = new Build();
- build.setFinalName( getArtifactId() + "-" + getVersion() );
- build.setDirectory( getBasedir() + "/target/test/unit/project-010/target" );
+ build.setFinalName(getArtifactId() + "-" + getVersion());
+ build.setDirectory(getBasedir() + "/target/test/unit/project-010/target");
- setBuild( build );
+ setBuild(build);
String basedir = getBasedir().getAbsolutePath();
List<String> compileSourceRoots = new ArrayList<>();
- compileSourceRoots.add( basedir + "/target/test-classes/unit/project-010/src/main/java" );
- setCompileSourceRoots( compileSourceRoots );
+ compileSourceRoots.add(basedir + "/target/test-classes/unit/project-010/src/main/java");
+ setCompileSourceRoots(compileSourceRoots);
List<String> testCompileSourceRoots = new ArrayList<>();
- testCompileSourceRoots.add( basedir + "/target/test-classes/unit/project-010/src/test/java" );
- setTestCompileSourceRoots( testCompileSourceRoots );
+ testCompileSourceRoots.add(basedir + "/target/test-classes/unit/project-010/src/test/java");
+ setTestCompileSourceRoots(testCompileSourceRoots);
- setResources( model.getBuild().getResources() );
- setTestResources( model.getBuild().getTestResources() );
+ setResources(model.getBuild().getResources());
+ setTestResources(model.getBuild().getTestResources());
SourcePluginArtifactStub artifact =
- new SourcePluginArtifactStub( getGroupId(), getArtifactId(), getVersion(), getPackaging(), null );
- artifact.setArtifactHandler( new DefaultArtifactHandlerStub() );
- artifact.setType( "jar" );
- artifact.setBaseVersion( "1.0-SNAPSHOT" );
- setArtifact( artifact );
+ new SourcePluginArtifactStub(getGroupId(), getArtifactId(), getVersion(), getPackaging(), null);
+ artifact.setArtifactHandler(new DefaultArtifactHandlerStub());
+ artifact.setType("jar");
+ artifact.setBaseVersion("1.0-SNAPSHOT");
+ setArtifact(artifact);
- }
- catch ( Exception e )
- {
+ } catch (Exception e) {
e.printStackTrace();
}
}
- public Build getBuild()
- {
+ public Build getBuild() {
return build;
}
- public void setBuild( Build build )
- {
+ public void setBuild(Build build) {
this.build = build;
}
- public List<Resource> getResources()
- {
+ public List<Resource> getResources() {
return resources;
}
- public void setResources( List<Resource> resources )
- {
+ public void setResources(List<Resource> resources) {
this.resources = resources;
}
- public List<Resource> getTestResources()
- {
+ public List<Resource> getTestResources() {
return testResources;
}
- public void setTestResources( List<Resource> testResources )
- {
+ public void setTestResources(List<Resource> testResources) {
this.testResources = testResources;
}
}
diff --git a/src/test/java/org/apache/maven/plugins/source/stubs/SourcePluginArtifactStub.java b/src/test/java/org/apache/maven/plugins/source/stubs/SourcePluginArtifactStub.java
index c09a6df..b758a17 100644
--- a/src/test/java/org/apache/maven/plugins/source/stubs/SourcePluginArtifactStub.java
+++ b/src/test/java/org/apache/maven/plugins/source/stubs/SourcePluginArtifactStub.java
@@ -1,5 +1,3 @@
-package org.apache.maven.plugins.source.stubs;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@ package org.apache.maven.plugins.source.stubs;
* specific language governing permissions and limitations
* under the License.
*/
+package org.apache.maven.plugins.source.stubs;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.versioning.VersionRange;
@@ -26,9 +25,7 @@ import org.apache.maven.plugin.testing.stubs.ArtifactStub;
/**
* @author <a href="mailto:oching@exist.com">Maria Odea Ching</a>
*/
-public class SourcePluginArtifactStub
- extends ArtifactStub
-{
+public class SourcePluginArtifactStub extends ArtifactStub {
private String groupId;
@@ -46,77 +43,63 @@ public class SourcePluginArtifactStub
private ArtifactHandler handler;
- public SourcePluginArtifactStub( String groupId, String artifactId, String version, String type, String classifier )
- {
+ public SourcePluginArtifactStub(String groupId, String artifactId, String version, String type, String classifier) {
this.groupId = groupId;
this.artifactId = artifactId;
this.version = version;
this.type = type;
this.classifier = classifier;
- versionRange = VersionRange.createFromVersion( version );
+ versionRange = VersionRange.createFromVersion(version);
}
- public void setGroupId( String groupId )
- {
+ public void setGroupId(String groupId) {
this.groupId = groupId;
}
- public String getGroupId()
- {
+ public String getGroupId() {
return groupId;
}
- public void setArtifactId( String artifactId )
- {
+ public void setArtifactId(String artifactId) {
this.artifactId = artifactId;
}
- public String getArtifactId()
- {
+ public String getArtifactId() {
return artifactId;
}
- public void setVersion( String version )
- {
+ public void setVersion(String version) {
this.version = version;
}
- public String getVersion()
- {
+ public String getVersion() {
return version;
}
- public void setType( String packaging )
- {
+ public void setType(String packaging) {
this.type = packaging;
}
- public String getType()
- {
+ public String getType() {
return type;
}
- public void setClassifier( String classifier )
- {
+ public void setClassifier(String classifier) {
this.classifier = classifier;
}
- public String getClassifier()
- {
+ public String getClassifier() {
return classifier;
}
- public boolean hasClassifier()
- {
+ public boolean hasClassifier() {
return classifier != null;
}
- public String getId()
- {
+ public String getId() {
String id = groupId + ":" + artifactId + ":" + type + ":";
- if ( hasClassifier() )
- {
+ if (hasClassifier()) {
id = id + getClassifier() + ":";
}
@@ -125,34 +108,27 @@ public class SourcePluginArtifactStub
return id;
}
- public VersionRange getVersionRange()
- {
+ public VersionRange getVersionRange() {
return versionRange;
}
- public void setVersionRange( VersionRange versionRange )
- {
+ public void setVersionRange(VersionRange versionRange) {
this.versionRange = versionRange;
}
- public String getBaseVersion()
- {
+ public String getBaseVersion() {
return baseVersion;
}
- public void setBaseVersion( String baseVersion )
- {
+ public void setBaseVersion(String baseVersion) {
this.baseVersion = baseVersion;
}
- public ArtifactHandler getArtifactHandler()
- {
+ public ArtifactHandler getArtifactHandler() {
return handler;
}
- public void setArtifactHandler( ArtifactHandler handler )
- {
+ public void setArtifactHandler(ArtifactHandler handler) {
this.handler = handler;
}
-
}