Skip to content

Commit

Permalink
[MRESOURCES-283] Require Java 8 and upgrade deps
Browse files Browse the repository at this point in the history
  • Loading branch information
slachiewicz committed Apr 27, 2022
1 parent 61c076d commit ad4b2ad
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 36 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ under the License.
<properties>
<mavenFilteringVersion>3.2.0</mavenFilteringVersion>
<mavenVersion>3.1.0</mavenVersion>
<javaVersion>7</javaVersion>
<javaVersion>8</javaVersion>
<project.build.outputTimestamp>2020-08-05T15:25:21Z</project.build.outputTimestamp>
</properties>

Expand Down Expand Up @@ -126,13 +126,13 @@ under the License.
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
<version>2.11.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
<version>3.12.0</version>
<scope>compile</scope>
</dependency>

Expand All @@ -157,7 +157,7 @@ under the License.
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.3.0</version>
<version>3.4.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public class ResourcesMojo
/**
* @since 2.4
*/
private List<MavenResourcesFiltering> mavenFilteringComponents = new ArrayList<MavenResourcesFiltering>();
private List<MavenResourcesFiltering> mavenFilteringComponents = new ArrayList<>();

/**
* stop searching endToken at the end of line
Expand Down Expand Up @@ -324,7 +324,7 @@ public void execute()

MavenResourcesExecution mavenResourcesExecution =
new MavenResourcesExecution( getResources(), getOutputDirectory(), project, encoding, combinedFilters,
Collections.<String>emptyList(), session );
Collections.emptyList(), session );

mavenResourcesExecution.setEscapeWindowsPaths( escapeWindowsPaths );

Expand Down Expand Up @@ -443,7 +443,7 @@ protected List<String> getCombinedFiltersList()
}
else
{
List<String> result = new ArrayList<String>();
List<String> result = new ArrayList<>();

if ( useBuildFilters && buildFilters != null && !buildFilters.isEmpty() )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.util.Enumeration;
import java.util.Properties;

Expand Down Expand Up @@ -93,7 +94,7 @@ private void loadValidationProperties( File validationPropFile )

try
{
in = new FileInputStream( validationPropFile );
in = Files.newInputStream( validationPropFile.toPath() );
validationProp.load( in );
in.close();
in = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,7 @@ public void testResourceSystemProperties_Filtering()
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request.setSystemProperties( System.getProperties() );

MavenSession mavenSession =
new MavenSession( (PlexusContainer) null, (RepositorySystemSession) null, request, null );
MavenSession mavenSession = new MavenSession( null, null, request, null );
setVariableValueToObject( mojo, "session", mavenSession );
mojo.execute();

Expand All @@ -357,15 +356,10 @@ public void testResourceSystemProperties_Filtering()
assertTrue( userDir.exists() );

Properties props = new Properties();
final FileInputStream inStream = new FileInputStream( new File( resourcesDir, "file4.txt" ) );
try
try ( FileInputStream inStream = new FileInputStream( new File( resourcesDir, "file4.txt" ) ) )
{
props.load( inStream );
}
finally
{
inStream.close();
}
File fileFromFiltering = new File( props.getProperty( "current-working-directory" ) );

assertTrue( fileFromFiltering.getAbsolutePath() + " does not exist.", fileFromFiltering.exists() );
Expand Down Expand Up @@ -455,7 +449,7 @@ public void testPropertyFiles_Filtering()
MavenProjectResourcesStub project = new MavenProjectResourcesStub( "resourcePropertyFiles_Filtering" );
List<Resource> resources = project.getBuild()
.getResources();
LinkedList<String> filterList = new LinkedList<String>();
LinkedList<String> filterList = new LinkedList<>();

assertNotNull( mojo );

Expand Down Expand Up @@ -491,7 +485,7 @@ public void testPropertyFiles_Extra()
MavenProjectResourcesStub project = new MavenProjectResourcesStub( "resourcePropertyFiles_Extra" );
List<Resource> resources = project.getBuild()
.getResources();
LinkedList<String> filterList = new LinkedList<String>();
LinkedList<String> filterList = new LinkedList<>();

assertNotNull( mojo );

Expand Down Expand Up @@ -527,8 +521,8 @@ public void testPropertyFiles_MainAndExtra()
MavenProjectResourcesStub project = new MavenProjectResourcesStub( "resourcePropertyFiles_MainAndExtra" );
List<Resource> resources = project.getBuild()
.getResources();
LinkedList<String> filterList = new LinkedList<String>();
LinkedList<String> extraFilterList = new LinkedList<String>();
LinkedList<String> filterList = new LinkedList<>();
LinkedList<String> extraFilterList = new LinkedList<>();

assertNotNull( mojo );

Expand Down Expand Up @@ -575,7 +569,7 @@ public void testPropertyFiles_Filtering_TokensInFilters()
new MavenProjectResourcesStub( "resourcePropertyFiles_Filtering_TokensInFilters" );
final List<Resource> resources = project.getBuild()
.getResources();
final LinkedList<String> filterList = new LinkedList<String>();
final LinkedList<String> filterList = new LinkedList<>();

assertNotNull( mojo );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class ItFilter
public List<String> getDefaultNonFilteredFileExtensions()
{
// no op
return Collections.<String>emptyList();
return Collections.emptyList();
}

/**
Expand All @@ -68,7 +68,7 @@ public void filterResources( MavenResourcesExecution mavenResourcesExecution )
try
{
File f = new File( mavenResourcesExecution.getOutputDirectory(), "foo.txt" );
List<String> lines = new ArrayList<String>();
List<String> lines = new ArrayList<>();

lines.add( "foo" );
lines.add( "version="+mavenResourcesExecution.getMavenProject().getVersion() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public class MavenProjectBasicStub
protected String description;

public MavenProjectBasicStub( String id )
throws Exception
{
properties = new Properties();
identifier = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public MavenProjectBuildStub( String key )
super( key );

build = new Build();
fileList = new ArrayList<String>();
directoryList = new ArrayList<String>();
dataMap = new HashMap<String, String>();
fileList = new ArrayList<>();
directoryList = new ArrayList<>();
dataMap = new HashMap<>();
setupBuild();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,49 +39,49 @@ public MavenProjectResourcesStub( String id )

public void addInclude( String pattern )
{
( (Resource) build.getResources().get( 0 ) ).addInclude( pattern );
build.getResources().get( 0 ).addInclude( pattern );
}

public void addExclude( String pattern )
{
( (Resource) build.getResources().get( 0 ) ).addExclude( pattern );
build.getResources().get( 0 ).addExclude( pattern );
}

public void addTestInclude( String pattern )
{
( (Resource) build.getTestResources().get( 0 ) ).addInclude( pattern );
build.getTestResources().get( 0 ).addInclude( pattern );
}

public void addTestExclude( String pattern )
{
( (Resource) build.getTestResources().get( 0 ) ).addExclude( pattern );
build.getTestResources().get( 0 ).addExclude( pattern );
}

public void setTargetPath( String path )
{
( (Resource) build.getResources().get( 0 ) ).setTargetPath( path );
build.getResources().get( 0 ).setTargetPath( path );
}

public void setTestTargetPath( String path )
{
( (Resource) build.getTestResources().get( 0 ) ).setTargetPath( path );
build.getTestResources().get( 0 ).setTargetPath( path );
}

public void setDirectory( String dir )
{
( (Resource) build.getResources().get( 0 ) ).setDirectory( dir );
build.getResources().get( 0 ).setDirectory( dir );
}

public void setTestDirectory( String dir )
{
( (Resource) build.getTestResources().get( 0 ) ).setDirectory( dir );
build.getTestResources().get( 0 ).setDirectory( dir );
}

public void setResourceFiltering( int nIndex, boolean filter )
{
if ( build.getResources().size() > nIndex )
{
( (Resource) build.getResources().get( nIndex ) ).setFiltering( filter );
build.getResources().get( nIndex ).setFiltering( filter );
}
}

Expand Down

0 comments on commit ad4b2ad

Please sign in to comment.