Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -162,6 +162,7 @@ protected void setUp()

artifact.setFile( getPluginArtifactFile() );
pluginDescriptor.setPluginArtifact( artifact );
//noinspection ArraysAsListWithZeroOrOneArgument
pluginDescriptor.setArtifacts( Arrays.asList( artifact ) );

for ( ComponentDescriptor<?> desc : pluginDescriptor.getComponents() )
Expand Down Expand Up @@ -237,7 +238,7 @@ else if ( "jar".equalsIgnoreCase( resource.getProtocol() ) )
protected InputStream getPublicDescriptorStream()
throws Exception
{
return new FileInputStream( new File( getPluginDescriptorPath() ) );
return Files.newInputStream( new File( getPluginDescriptorPath() ).toPath() );
}

protected String getPluginDescriptorPath()
Expand All @@ -258,7 +259,7 @@ protected void setupContainer()
{
List<Module> modules = new ArrayList<>();
addGuiceModules( modules );
container = new DefaultPlexusContainer( cc, modules.toArray( new Module[modules.size()] ) );
container = new DefaultPlexusContainer( cc, modules.toArray( new Module[0] ) );
}
catch ( PlexusContainerException e )
{
Expand All @@ -270,22 +271,19 @@ protected void setupContainer()
/**
* @since 3.0.0
*/
@SuppressWarnings( "EmptyMethod" )
protected void addGuiceModules( List<Module> modules )
{
// no custom guice modules by default
}

protected ContainerConfiguration setupContainerConfiguration()
{
ClassWorld classWorld = new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() );

ContainerConfiguration cc = new DefaultContainerConfiguration()
.setClassWorld( classWorld )
return new DefaultContainerConfiguration()
.setClassWorld( new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() ) )
.setClassPathScanning( PlexusConstants.SCANNING_INDEX )
.setAutoWiring( true )
.setName( "maven" );

return cc;
.setName( "maven" );
}

@Override
Expand Down Expand Up @@ -498,6 +496,7 @@ protected MavenSession newMavenSession( MavenProject project )

MavenSession session = new MavenSession( container, MavenRepositorySystemUtils.newSession(), request, result );
session.setCurrentProject( project );
//noinspection ArraysAsListWithZeroOrOneArgument
session.setProjects( Arrays.asList( project ) );
return session;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public void createUnpackableFile( Artifact artifact, File destFile )
WarArchiver war = (WarArchiver) archiver;
// the use of this is counter-intuitive:
// http://jira.codehaus.org/browse/PLX-286
war.setIgnoreWebxml( false );
war.setExpectWebXml( false );
}
archiver.createArchive();
}
Expand Down Expand Up @@ -549,7 +549,7 @@ public static void setVariableValueToObject( Object object, String variable, Obj
*/
public static String getFormattedFileName( Artifact artifact, boolean removeVersion )
{
String destFileName = null;
String destFileName;

// if there is a file and we aren't stripping the version, just get the
// name directly
Expand All @@ -560,7 +560,7 @@ public static String getFormattedFileName( Artifact artifact, boolean removeVers
else
// if offline
{
String versionString = null;
String versionString;
if ( !removeVersion )
{
versionString = "-" + artifact.getVersion();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ protected void before() throws Throwable
/**
* May be overridden in the implementation to do stuff after the current test was run.
*/
protected void after()
@SuppressWarnings( "EmptyMethod" )
protected void after()
{

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public Object evaluate( String expr )
}

// Was not an expression
if ( expression.indexOf( "$$" ) > -1 )
if ( expression.contains( "$$" ) )
{
return expression.replaceAll( "\\$\\$", "\\$" );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Set;
import java.util.TreeSet;
Expand Down Expand Up @@ -116,11 +117,7 @@ public static void assertDirectoryContents( File dir, String... expectedPaths )
scanner.addDefaultExcludes();
scanner.scan();

Set<String> actual = new TreeSet<>();
for ( String path : scanner.getIncludedFiles() )
{
actual.add( path );
}
Set<String> actual = new TreeSet<>( Arrays.asList( scanner.getIncludedFiles() ) );
for ( String path : scanner.getIncludedDirectories() )
{
if ( path.length() > 0 )
Expand All @@ -132,10 +129,7 @@ public static void assertDirectoryContents( File dir, String... expectedPaths )
Set<String> expected = new TreeSet<>();
if ( expectedPaths != null )
{
for ( String path : expectedPaths )
{
expected.add( path );
}
expected.addAll( Arrays.asList( expectedPaths ) );
}

// compare textual representation to make diff easier to understand
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,15 @@ public String getId()
@Override
public String getDependencyConflictId()
{
StringBuffer buffer = new StringBuffer();

buffer.append( getGroupId() );
buffer.append( ":" ).append( getArtifactId() );
buffer.append( ":" ).append( getType() );
buffer.append( ":" ).append( getClassifier() );

return buffer.toString();
return getGroupId() + ":" + getArtifactId() + ":" + getType() + ":" + getClassifier();
}

/**
* By default, do nothing.
*
* @see org.apache.maven.artifact.Artifact#addMetadata(org.apache.maven.artifact.metadata.ArtifactMetadata)
*/
@SuppressWarnings( "deprecation" )
@Override
public void addMetadata( ArtifactMetadata artifactMetadata )
{
Expand All @@ -210,6 +204,7 @@ public void addMetadata( ArtifactMetadata artifactMetadata )
* @return <code>null</code>.
* @see org.apache.maven.artifact.Artifact#getMetadataList()
*/
@SuppressWarnings( "deprecation" )
@Override
public Collection<ArtifactMetadata> getMetadataList()
{
Expand Down Expand Up @@ -549,6 +544,7 @@ public boolean isFromAuthoritativeRepository()
return true;
}

@SuppressWarnings( "EmptyMethod" )
public void setFromAuthoritativeRepository( boolean fromAuthoritativeRepository )
{
// nothing
Expand Down
Loading