updated parent pom and fixed little errors reported by Checkstyle

This commit is contained in:
Hervé Boutemy 2015-03-04 02:03:15 +01:00
parent ac9d11c620
commit 623d54f199
32 changed files with 106 additions and 94 deletions

View File

@ -24,6 +24,9 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
/**
*
*/
public class DefaultStatefulSingleton
implements StatefulSingleton
{

View File

@ -22,6 +22,9 @@ package org.apache.maven.coreit.component;
import java.io.File;
import java.io.IOException;
/**
*
*/
public interface StatefulSingleton
{

View File

@ -21,7 +21,6 @@ package org.apache.maven.plugin.coreit;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import java.io.File;
import java.io.FileOutputStream;
@ -111,7 +110,7 @@ public class CheckThreadSafetyMojo
{
// wait for start
}
for ( int j = 0; j < 10000; j++ )
for ( int j = 0; j < 10 * 1000; j++ )
{
try
{

View File

@ -1,4 +1,5 @@
package org.apache.maven.plugin.coreit;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@ -33,7 +34,6 @@ import org.apache.maven.plugin.MojoFailureException;
import java.io.File;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* @author Olivier Lamy
@ -114,6 +114,9 @@ public class InstallArtifactsMojo
}
}
/**
*
*/
public static class FlatRepositoryLayout
implements ArtifactRepositoryLayout
{

View File

@ -128,7 +128,8 @@ public class ResolveTransitiveMojo
if ( thread.error != null )
{
throw new MojoExecutionException( "Failed to resolve artifacts: " + thread.error.getMessage(), thread.error );
throw new MojoExecutionException( "Failed to resolve artifacts: " + thread.error.getMessage(),
thread.error );
}
if ( propertiesFile != null )
@ -187,7 +188,8 @@ public class ResolveTransitiveMojo
dependency.getVersion(), dependency.getType(),
dependency.getClassifier() );
getLog().info( "[MAVEN-CORE-IT-LOG] Resolving " + ResolveTransitiveMojo.this.getId( artifact ) );
getLog().info( "[MAVEN-CORE-IT-LOG] Resolving "
+ ResolveTransitiveMojo.this.getId( artifact ) );
artifacts.add( artifact );
}

View File

@ -21,7 +21,6 @@ package org.apache.maven.plugin.coreit;
import java.io.File;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

View File

@ -89,6 +89,7 @@ public class CatchMojo
}
catch ( IOException e )
{
// ignore
}
}
}

View File

@ -76,7 +76,8 @@ public class AggregateTestMojo
writeArtifacts( filter( projectArtifacts, project ), project.getArtifacts() );
// NOTE: We can't make any assumptions about the class path but as a minimum it must not cause an exception
// NOTE: We can't make any assumptions about the class path but as a minimum it must not cause an
// exception
project.getTestClasspathElements();
}
}

View File

@ -295,6 +295,7 @@ public abstract class AbstractDependencyMojo
for ( int i = 0; i < digest.length; i++ )
{
@SuppressWarnings( "checkstyle:magicnumber" )
int b = digest[i] & 0xFF;
if ( b < 0x10 )

View File

@ -94,7 +94,8 @@ public class AggregateTestMojo
writeArtifacts( filter( projectArtifacts, project ), project.getArtifacts() );
writeClassPath( filter( testClassPath, project ), project.getTestClasspathElements() );
writeClassPathChecksums( filter( testClassPathChecksums, project ), project.getTestClasspathElements() );
writeClassPathChecksums( filter( testClassPathChecksums, project ),
project.getTestClasspathElements() );
}
}
catch ( DependencyResolutionRequiredException e )

View File

@ -143,7 +143,8 @@ public class ResolveOneDependencyMojo
}
Set depArtifacts = new HashSet();
Artifact artifact = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier );
Artifact artifact =
artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier );
depArtifacts.add( artifact );
ScopeArtifactFilter scopeFilter = new ScopeArtifactFilter( scope );
@ -193,7 +194,7 @@ public class ResolveOneDependencyMojo
return;
}
}
getLog().info(" RESOLVE-ONE-DEPENDENCY " + artifact.toString() + " $ NOT-RESOLVED" );
getLog().info( " RESOLVE-ONE-DEPENDENCY " + artifact.toString() + " $ NOT-RESOLVED" );
}
}
}

View File

@ -31,7 +31,8 @@ public class MojoFailureExceptionMojo
{
/**
* Message used in {@link MojoFailureException#MojoFailureException(String)}, unless longMessage
* is supplied; then, this becomes the short message in {@link MojoFailureException#MojoFailureException(Object, String, String)}.
* is supplied; then, this becomes the short message in
* {@link MojoFailureException#MojoFailureException(Object, String, String)}.
*
* @parameter property="error.message" default-value="Planned MojoExecutionException."
* @required

View File

@ -19,12 +19,14 @@ package org.apache.maven.plugin.coreit;
* under the License.
*/
import java.util.*;
import java.util.List;
import org.apache.maven.artifact.*;
import org.apache.maven.artifact.factory.*;
import org.apache.maven.artifact.resolver.*;
import org.apache.maven.artifact.repository.*;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;

View File

@ -26,6 +26,8 @@ import org.apache.maven.project.MavenProject;
import org.apache.maven.project.interpolation.ModelInterpolationException;
import org.apache.maven.project.interpolation.ModelInterpolator;
import java.util.Properties;
/**
* @goal path-interpolation
* @phase validate
@ -44,9 +46,11 @@ public class PathInterpolationMojo
{
try
{
Properties props = project.getProperties();
modelInterpolator.interpolate( project.getOriginalModel(),
project.getBasedir(),
new DefaultProjectBuilderConfiguration().setExecutionProperties( project.getProperties() ),
new DefaultProjectBuilderConfiguration().setExecutionProperties( props ),
true );
}
catch ( ModelInterpolationException e )

View File

@ -25,7 +25,6 @@ import org.apache.maven.plugin.MojoExecutionException;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Map;
/**
* Mojo which touches a file without requiring a project.

View File

@ -45,7 +45,8 @@ public class VelocityMojo
try
{
// velocityComponent engine should not be null
// this is the real test to check that we got the right Initializable interface in both Plexus and the component
// this is the real test to check that we got the right Initializable interface in both Plexus and the
// component
/*
* NOTE: There's a bug in the plexus-velocity:1.1.7 component that fails to transform "/template.vm" into
* a proper resource name before searching the context class loader so we avoid the leading slash here.

View File

@ -1,4 +1,5 @@
package org.apache.maven.its.plugins.plexuslifecycle;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file

View File

@ -1,4 +1,5 @@
package org.apache.maven.its.plugins.plexuslifecycle;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file

View File

@ -1,4 +1,5 @@
package org.apache.maven.its.plugins.plexuslifecycle;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file

View File

@ -23,6 +23,9 @@ import java.io.IOException;
import org.codehaus.plexus.util.xml.pull.XmlSerializer;
/**
*
*/
public class Xpp3Dom
{

View File

@ -23,6 +23,9 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
/**
*
*/
public class MXSerializer
implements XmlSerializer
{

View File

@ -23,6 +23,9 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.Writer;
/**
*
*/
public interface XmlSerializer
{

View File

@ -47,7 +47,9 @@ public class PluginParamInterpolationMojo
if ( !myDirectory.equals( value ) )
{
throw new MojoExecutionException( "Directory supplied: " + myDirectory + " is not the same as the project build directory: " + project.getBuild().getDirectory() + " + '/foo'" );
throw new MojoExecutionException( "Directory supplied: " + myDirectory
+ " is not the same as the project build directory: " + project.getBuild().getDirectory()
+ " + '/foo'" );
}
}

View File

@ -45,7 +45,8 @@ public class PropertyInterpolationMojo
if ( !value.equals( targetValue ) )
{
throw new MojoExecutionException( "Property value of 'myDirectory': " + value + " should equal the 'foo' subpath of the project build directory: " + targetValue );
throw new MojoExecutionException( "Property value of 'myDirectory': " + value
+ " should equal the 'foo' subpath of the project build directory: " + targetValue );
}
}

View File

@ -101,7 +101,8 @@ public class CoreItMojo
}
else
{
getLog().warn( "[MAVEN-CORE-IT-LOG] Toolchain #" + selected + " can't be selected, found only " + tcs.length );
getLog().warn( "[MAVEN-CORE-IT-LOG] Toolchain #" + selected + " can't be selected, found only "
+ tcs.length );
}
}

View File

@ -52,28 +52,28 @@ public class CopyPomMojo
{
try
{
File dest = new File( outputFile );
File dir = dest.getParentFile();
if ( !dir.exists() )
{
dir.mkdirs();
}
File dest = new File( outputFile );
File dir = dest.getParentFile();
getLog().info( "Copying POM to file: " + dest.getAbsolutePath() );
if ( !dir.exists() )
{
dir.mkdirs();
}
FileInputStream in = new FileInputStream( pomFile );
FileOutputStream out = new FileOutputStream( dest );
getLog().info( "Copying POM to file: " + dest.getAbsolutePath() );
int read = -1;
byte[] buf = new byte[4096];
while( ( read = in.read( buf ) ) > -1 )
{
out.write( buf, 0, read );
}
in.close();
out.close();
FileInputStream in = new FileInputStream( pomFile );
FileOutputStream out = new FileOutputStream( dest );
int read = -1;
byte[] buf = new byte[4 * 1024];
while ( ( read = in.read( buf ) ) > -1 )
{
out.write( buf, 0, read );
}
in.close();
out.close();
}
catch ( IOException e )
{

View File

@ -98,7 +98,8 @@ public class CoreItTouchMojo
{
if ( fail )
{
throw new MojoExecutionException( "Failing per \'fail\' parameter (specified in pom or system properties)" );
throw new MojoExecutionException( "Failing per \'fail\' parameter"
+ " (specified in pom or system properties)" );
}
File outDir = new File( outputDirectory );

View File

@ -52,9 +52,10 @@ public class UsesPropertiesMojo
file.getParentFile().mkdirs();
FileOutputStream fos = new FileOutputStream( file );
properties.store( fos, "# Properties generated by the execution of a mojo that uses interpolated POM values for configuration." );
properties.store( fos, "# Properties generated by the execution of a mojo that uses"
+ " interpolated POM values for configuration." );
}
catch( Exception e )
catch ( Exception e )
{
getLog().error( "Error creating mojo generated properties.", e );
}

View File

@ -48,7 +48,7 @@ public class UsesWagonMojo
getLog().info( "[MAVEN-CORE-IT-LOG] Looking up wagon for protocol file" );
fileWagon = wagonManager.getWagon( "file" );
}
catch( Exception e )
catch ( Exception e )
{
throw new MojoExecutionException( e.getMessage(), e );
}
@ -56,7 +56,7 @@ public class UsesWagonMojo
{
FileWagon theWagon = (FileWagon) fileWagon;
}
catch( ClassCastException e )
catch ( ClassCastException e )
{
getLog().error( "", e );
getLog().error( "Plugin Class Loaded by " + FileWagon.class.getClassLoader() );
@ -71,7 +71,7 @@ public class UsesWagonMojo
getLog().info( "[MAVEN-CORE-IT-LOG] Looking up wagon for protocol scp" );
scpWagon = wagonManager.getWagon( "scp" );
}
catch( Exception e )
catch ( Exception e )
{
throw new MojoExecutionException( e.getMessage(), e );
}
@ -79,7 +79,7 @@ public class UsesWagonMojo
{
ScpWagon theWagon = (ScpWagon) scpWagon;
}
catch( ClassCastException e )
catch ( ClassCastException e )
{
getLog().error( "", e );
getLog().error( "Plugin Class Loaded by " + ScpWagon.class.getClassLoader() );

View File

@ -122,7 +122,7 @@ public class CoreItWagon
throws TransferFailedException, ResourceDoesNotExistException
{
String resName = inputData.getResource().getName();
if ( resName.endsWith( ".xml" ) ||resName.endsWith( ".md5" ) || resName.endsWith( ".sha1" ) )
if ( resName.endsWith( ".xml" ) || resName.endsWith( ".md5" ) || resName.endsWith( ".sha1" ) )
{
throw new ResourceDoesNotExistException( resName );
}

View File

@ -86,9 +86,9 @@ public abstract class AbstractMavenIntegrationTestCase
{
versionRange = VersionRange.createFromVersionSpec( versionRangeStr );
}
catch ( InvalidVersionSpecificationException e)
catch ( InvalidVersionSpecificationException e )
{
throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRangeStr ).initCause( e );
throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRangeStr, e );
}
ArtifactVersion version = getMavenVersion();
@ -177,9 +177,9 @@ public abstract class AbstractMavenIntegrationTestCase
{
versionRange = VersionRange.createFromVersionSpec( versionRangeStr );
}
catch ( InvalidVersionSpecificationException e)
catch ( InvalidVersionSpecificationException e )
{
throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRangeStr ).initCause( e );
throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRangeStr, e );
}
ArtifactVersion version = getMavenVersion();
@ -256,7 +256,7 @@ public abstract class AbstractMavenIntegrationTestCase
}
catch ( InvalidVersionSpecificationException e )
{
throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRange ).initCause( e );
throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRange, e );
}
ArtifactVersion version = getJavaVersion();
@ -283,7 +283,7 @@ public abstract class AbstractMavenIntegrationTestCase
}
catch ( InvalidVersionSpecificationException e )
{
throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRange ).initCause( e );
throw (RuntimeException) new IllegalArgumentException( "Invalid version range: " + versionRange, e );
}
ArtifactVersion version = getMavenVersion();
@ -304,9 +304,10 @@ public abstract class AbstractMavenIntegrationTestCase
private class UnsupportedJavaVersionException
extends RuntimeException
{
@SuppressWarnings( "checkstyle:visibilitymodifier" )
public ArtifactVersion javaVersion;
@SuppressWarnings( "checkstyle:visibilitymodifier" )
public VersionRange supportedRange;
public UnsupportedJavaVersionException( ArtifactVersion javaVersion, VersionRange supportedRange )
@ -320,9 +321,10 @@ public abstract class AbstractMavenIntegrationTestCase
private class UnsupportedMavenVersionException
extends RuntimeException
{
@SuppressWarnings( "checkstyle:visibilitymodifier" )
public ArtifactVersion mavenVersion;
@SuppressWarnings( "checkstyle:visibilitymodifier" )
public VersionRange supportedRange;
public UnsupportedMavenVersionException( ArtifactVersion mavenVersion, VersionRange supportedRange )
@ -444,7 +446,8 @@ public abstract class AbstractMavenIntegrationTestCase
else
{
//
// Make is easier to run ITs from m2e in Maven IT mode without having to set any additional properties.
// Make is easier to run ITs from m2e in Maven IT mode without having to set any additional
// properties.
//
settingsFile = new File( "target/test-classes", settingsFile.getPath() );
}
@ -479,25 +482,25 @@ public abstract class AbstractMavenIntegrationTestCase
return verifier;
}
static public void assertCanonicalFileEquals( String message, File expected, File actual )
public static void assertCanonicalFileEquals( String message, File expected, File actual )
throws IOException
{
assertEquals( message, expected.getCanonicalFile(), actual.getCanonicalFile() );
}
static public void assertCanonicalFileEquals( File expected, File actual )
public static void assertCanonicalFileEquals( File expected, File actual )
throws IOException
{
assertCanonicalFileEquals( null, expected, actual );
}
static public void assertCanonicalFileEquals( String message, String expected, String actual )
public static void assertCanonicalFileEquals( String message, String expected, String actual )
throws IOException
{
assertCanonicalFileEquals( message, new File( expected ), new File( actual ) );
}
static public void assertCanonicalFileEquals( String expected, String actual )
public static void assertCanonicalFileEquals( String expected, String actual )
throws IOException
{
assertCanonicalFileEquals( null, new File( expected ), new File( actual ) );

View File

@ -25,7 +25,7 @@ under the License.
<parent>
<groupId>org.apache.maven</groupId>
<artifactId>maven-parent</artifactId>
<version>22</version>
<version>26</version>
<relativePath>../pom/maven/pom.xml</relativePath>
</parent>
@ -62,6 +62,7 @@ under the License.
<properties>
<maven.site.path>core-its</maven.site.path>
<maven.site.cache>${user.home}/maven-sites</maven.site.cache>
<rat.ignoreErrors>true</rat.ignoreErrors>
</properties>
<modules>
@ -79,37 +80,6 @@ under the License.
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>
<version>1.0</version>
<configuration>
<checkoutDirectory>${maven.site.cache}/${maven.site.path}</checkoutDirectory>
<tryUpdate>true</tryUpdate>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<repository>
<id>apache.snapshots</id>