Skip to content

Commit d7c4d28

Browse files
committed
Bump Maven to 3.9.11 while keep prerequisites on 3.6.3
Remove redundant dependencies and code cleanup to remove warnings
1 parent e33f1ec commit d7c4d28

File tree

9 files changed

+42
-106
lines changed

9 files changed

+42
-106
lines changed

pom.xml

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ under the License.
4646
</contributors>
4747

4848
<prerequisites>
49-
<maven>${mavenVersion}</maven>
49+
<maven>3.6.3</maven>
5050
</prerequisites>
5151

5252
<scm>
@@ -72,7 +72,7 @@ under the License.
7272

7373
<properties>
7474
<mavenFilteringVersion>3.4.0</mavenFilteringVersion>
75-
<mavenVersion>3.2.5</mavenVersion>
75+
<mavenVersion>3.9.11</mavenVersion>
7676
<javaVersion>8</javaVersion>
7777
<project.build.outputTimestamp>2023-03-21T12:01:37Z</project.build.outputTimestamp>
7878

@@ -98,40 +98,22 @@ under the License.
9898
<version>${mavenVersion}</version>
9999
<scope>provided</scope>
100100
</dependency>
101-
<dependency>
102-
<groupId>org.apache.maven</groupId>
103-
<artifactId>maven-settings</artifactId>
104-
<version>${mavenVersion}</version>
105-
<scope>provided</scope>
106-
</dependency>
107101
<dependency>
108102
<groupId>org.apache.maven.plugin-tools</groupId>
109103
<artifactId>maven-plugin-annotations</artifactId>
110104
<version>${version.maven-plugin-tools}</version>
111105
<scope>provided</scope>
112106
</dependency>
113-
<dependency>
114-
<groupId>org.codehaus.plexus</groupId>
115-
<artifactId>plexus-interpolation</artifactId>
116-
<version>1.29</version>
117-
<scope>runtime</scope>
118-
</dependency>
119107
<dependency>
120108
<groupId>org.eclipse.sisu</groupId>
121109
<artifactId>org.eclipse.sisu.plexus</artifactId>
122-
<version>0.3.5</version>
123110
<scope>provided</scope>
124111
</dependency>
125112
<dependency>
126113
<groupId>org.codehaus.plexus</groupId>
127114
<artifactId>plexus-utils</artifactId>
128115
<scope>test</scope>
129116
</dependency>
130-
<dependency>
131-
<groupId>org.codehaus.plexus</groupId>
132-
<artifactId>plexus-xml</artifactId>
133-
<scope>test</scope>
134-
</dependency>
135117
<dependency>
136118
<groupId>org.apache.maven.shared</groupId>
137119
<artifactId>maven-filtering</artifactId>
@@ -147,14 +129,6 @@ under the License.
147129
<groupId>org.apache.commons</groupId>
148130
<artifactId>commons-lang3</artifactId>
149131
<version>3.19.0</version>
150-
<scope>compile</scope>
151-
</dependency>
152-
153-
<dependency>
154-
<groupId>org.apache.maven</groupId>
155-
<artifactId>maven-compat</artifactId>
156-
<version>${mavenVersion}</version>
157-
<scope>test</scope>
158132
</dependency>
159133
<dependency>
160134
<groupId>org.apache.maven.plugin-testing</groupId>
@@ -174,6 +148,11 @@ under the License.
174148
<version>1.6.3</version>
175149
<scope>test</scope>
176150
</dependency>
151+
<dependency>
152+
<groupId>javax.inject</groupId>
153+
<artifactId>javax.inject</artifactId>
154+
<version>1</version>
155+
</dependency>
177156
<dependency>
178157
<groupId>org.slf4j</groupId>
179158
<artifactId>slf4j-simple</artifactId>

src/it/user-filters/invoker.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
# to you under the Apache License, Version 2.0 (the
66
# "License"); you may not use this file except in compliance
77
# with the License. You may obtain a copy of the License at
8-
#
8+
#
99
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
10+
#
1111
# Unless required by applicable law or agreed to in writing,
1212
# software distributed under the License is distributed on an
1313
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
invoker.systemPropertiesFile = test.properties
18+
invoker.userPropertiesFile = test.properties

src/main/java/org/apache/maven/plugins/resources/ResourcesMojo.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
*/
1919
package org.apache.maven.plugins.resources;
2020

21+
import javax.inject.Inject;
22+
2123
import java.io.File;
24+
import java.nio.charset.Charset;
2225
import java.util.ArrayList;
2326
import java.util.Collection;
2427
import java.util.Collections;
@@ -32,7 +35,6 @@
3235
import org.apache.maven.model.Resource;
3336
import org.apache.maven.plugin.AbstractMojo;
3437
import org.apache.maven.plugin.MojoExecutionException;
35-
import org.apache.maven.plugins.annotations.Component;
3638
import org.apache.maven.plugins.annotations.LifecyclePhase;
3739
import org.apache.maven.plugins.annotations.Mojo;
3840
import org.apache.maven.plugins.annotations.Parameter;
@@ -50,7 +52,7 @@
5052
* @author Andreas Hoheneder
5153
* @author William Ferguson
5254
*/
53-
@Mojo(name = "resources", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, requiresProject = true, threadSafe = true)
55+
@Mojo(name = "resources", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, threadSafe = true)
5456
public class ResourcesMojo extends AbstractMojo {
5557

5658
/**
@@ -125,13 +127,13 @@ public class ResourcesMojo extends AbstractMojo {
125127
/**
126128
*
127129
*/
128-
@Component(role = MavenResourcesFiltering.class, hint = "default")
130+
@Inject
129131
protected MavenResourcesFiltering mavenResourcesFiltering;
130132

131133
/**
132134
*
133135
*/
134-
@Component(role = MavenResourcesFiltering.class)
136+
@Inject
135137
protected Map<String, MavenResourcesFiltering> mavenResourcesFilteringMap;
136138

137139
/**
@@ -297,7 +299,7 @@ public void execute() throws MojoExecutionException {
297299

298300
if (StringUtils.isBlank(encoding) && isFilteringEnabled(getResources())) {
299301
getLog().warn("File encoding has not been set, using platform encoding "
300-
+ System.getProperty("file.encoding")
302+
+ Charset.defaultCharset().displayName()
301303
+ ". Build is platform dependent!");
302304
getLog().warn("See https://maven.apache.org/general.html#encoding-warning");
303305
}

src/main/java/org/apache/maven/plugins/resources/TestResourcesMojo.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@
3434
* @author <a href="[email protected]">Michal Maczka</a>
3535
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
3636
*/
37-
@Mojo(
38-
name = "testResources",
39-
defaultPhase = LifecyclePhase.PROCESS_TEST_RESOURCES,
40-
requiresProject = true,
41-
threadSafe = true)
37+
@Mojo(name = "testResources", defaultPhase = LifecyclePhase.PROCESS_TEST_RESOURCES, threadSafe = true)
4238
public class TestResourcesMojo extends ResourcesMojo {
4339
/**
4440
* The output directory into which to copy the resources.

src/test/java/org/apache/maven/plugins/resources/AbstractPropertyUtilsTest.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.util.Properties;
2727

2828
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
29-
import org.codehaus.plexus.util.IOUtil;
3029

3130
/**
3231
* Base class for propertyutils test case
@@ -78,19 +77,10 @@ protected boolean validateProperties(Properties prop) {
7877
*
7978
* @param validationPropFile
8079
*/
81-
private void loadValidationProperties(File validationPropFile) {
80+
private void loadValidationProperties(File validationPropFile) throws IOException {
8281
validationProp = new Properties();
83-
InputStream in = null;
84-
85-
try {
86-
in = Files.newInputStream(validationPropFile.toPath());
82+
try (InputStream in = Files.newInputStream(validationPropFile.toPath())) {
8783
validationProp.load(in);
88-
in.close();
89-
in = null;
90-
} catch (IOException ex) {
91-
// TODO: do error handling
92-
} finally {
93-
IOUtil.close(in);
9484
}
9585
}
9686
}

src/test/java/org/apache/maven/plugins/resources/ResourcesMojoTest.java

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,17 @@ public class ResourcesMojoTest extends AbstractMojoTestCase {
4141

4242
/**
4343
* test mojo lookup, test harness should be working fine
44-
*
45-
* @throws Exception
4644
*/
4745
public void testHarnessEnvironment() throws Exception {
4846
File testPom = new File(getBasedir(), defaultPomFilePath);
49-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
47+
ResourcesMojo mojo = lookupMojo("resources", testPom);
5048

5149
assertNotNull(mojo);
5250
}
5351

54-
/**
55-
* @throws Exception
56-
*/
5752
public void testResourceDirectoryStructure() throws Exception {
5853
File testPom = new File(getBasedir(), defaultPomFilePath);
59-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
54+
ResourcesMojo mojo = lookupMojo("resources", testPom);
6055
MavenProjectResourcesStub project = new MavenProjectResourcesStub("resourceDirectoryStructure");
6156
List<Resource> resources = project.getBuild().getResources();
6257

@@ -86,12 +81,9 @@ public void testResourceDirectoryStructure() throws Exception {
8681
assertTrue(FileUtils.fileExists(resourcesDir + "/notpackage/test"));
8782
}
8883

89-
/**
90-
* @throws Exception
91-
*/
9284
public void testResourceDirectoryStructureRelativePath() throws Exception {
9385
File testPom = new File(getBasedir(), defaultPomFilePath);
94-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
86+
ResourcesMojo mojo = lookupMojo("resources", testPom);
9587
MavenProjectResourcesStub project = new MavenProjectResourcesStub("resourceDirectoryStructure_RelativePath");
9688
List<Resource> resources = project.getBuild().getResources();
9789

@@ -122,12 +114,9 @@ public void testResourceDirectoryStructureRelativePath() throws Exception {
122114
assertTrue(FileUtils.fileExists(resourcesDir + "/notpackage/test"));
123115
}
124116

125-
/**
126-
* @throws Exception
127-
*/
128117
public void testResourceEncoding() throws Exception {
129118
File testPom = new File(getBasedir(), defaultPomFilePath);
130-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
119+
ResourcesMojo mojo = lookupMojo("resources", testPom);
131120
MavenProjectResourcesStub project = new MavenProjectResourcesStub("encoding");
132121
List<Resource> resources = project.getBuild().getResources();
133122

@@ -151,12 +140,9 @@ public void testResourceEncoding() throws Exception {
151140
assertTrue(FileUtils.fileExists(resourcesDir + "/file4.txt"));
152141
}
153142

154-
/**
155-
* @throws Exception
156-
*/
157143
public void testResourceInclude() throws Exception {
158144
File testPom = new File(getBasedir(), defaultPomFilePath);
159-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
145+
ResourcesMojo mojo = lookupMojo("resources", testPom);
160146
MavenProjectResourcesStub project = new MavenProjectResourcesStub("resourceInclude");
161147
List<Resource> resources = project.getBuild().getResources();
162148

@@ -202,12 +188,9 @@ public void testResourceInclude() throws Exception {
202188
assertFalse(FileUtils.fileExists(resourcesDir + "/notpackage/nottest/file.txt"));
203189
}
204190

205-
/**
206-
* @throws Exception
207-
*/
208191
public void testResourceExclude() throws Exception {
209192
File testPom = new File(getBasedir(), defaultPomFilePath);
210-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
193+
ResourcesMojo mojo = lookupMojo("resources", testPom);
211194
MavenProjectResourcesStub project = new MavenProjectResourcesStub("resourceExclude");
212195
List<Resource> resources = project.getBuild().getResources();
213196

@@ -259,7 +242,7 @@ public void testResourceExclude() throws Exception {
259242
*/
260243
public void testResourceTargetPath() throws Exception {
261244
File testPom = new File(getBasedir(), defaultPomFilePath);
262-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
245+
ResourcesMojo mojo = lookupMojo("resources", testPom);
263246
MavenProjectResourcesStub project = new MavenProjectResourcesStub("resourceTargetPath");
264247
List<Resource> resources = project.getBuild().getResources();
265248

@@ -296,7 +279,7 @@ public void testResourceTargetPath() throws Exception {
296279
*/
297280
public void testResourceSystemPropertiesFiltering() throws Exception {
298281
File testPom = new File(getBasedir(), defaultPomFilePath);
299-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
282+
ResourcesMojo mojo = lookupMojo("resources", testPom);
300283
MavenProjectResourcesStub project = new MavenProjectResourcesStub("resourceSystemProperties_Filtering");
301284
List<Resource> resources = project.getBuild().getResources();
302285

@@ -342,7 +325,7 @@ public void testResourceSystemPropertiesFiltering() throws Exception {
342325
*/
343326
public void testResourceProjectPropertiesFiltering() throws Exception {
344327
File testPom = new File(getBasedir(), defaultPomFilePath);
345-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
328+
ResourcesMojo mojo = lookupMojo("resources", testPom);
346329
MavenProjectResourcesStub project = new MavenProjectResourcesStub("resourceProjectProperties_Filtering");
347330
List<Resource> resources = project.getBuild().getResources();
348331

@@ -373,7 +356,7 @@ public void testResourceProjectPropertiesFiltering() throws Exception {
373356
*/
374357
public void testProjectPropertyFilteringPropertyDestination() throws Exception {
375358
File testPom = new File(getBasedir(), defaultPomFilePath);
376-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
359+
ResourcesMojo mojo = lookupMojo("resources", testPom);
377360
MavenProjectResourcesStub project =
378361
new MavenProjectResourcesStub("resourcePojectProperty_Filtering_PropertyDestination");
379362
List<Resource> resources = project.getBuild().getResources();
@@ -408,7 +391,7 @@ public void testProjectPropertyFilteringPropertyDestination() throws Exception {
408391
*/
409392
public void testPropertyFilesFiltering() throws Exception {
410393
File testPom = new File(getBasedir(), defaultPomFilePath);
411-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
394+
ResourcesMojo mojo = lookupMojo("resources", testPom);
412395
MavenProjectResourcesStub project = new MavenProjectResourcesStub("resourcePropertyFiles_Filtering");
413396
List<Resource> resources = project.getBuild().getResources();
414397
LinkedList<String> filterList = new LinkedList<>();
@@ -441,7 +424,7 @@ public void testPropertyFilesFiltering() throws Exception {
441424
*/
442425
public void testPropertyFilesExtra() throws Exception {
443426
File testPom = new File(getBasedir(), defaultPomFilePath);
444-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
427+
ResourcesMojo mojo = lookupMojo("resources", testPom);
445428
MavenProjectResourcesStub project = new MavenProjectResourcesStub("resourcePropertyFiles_Extra");
446429
List<Resource> resources = project.getBuild().getResources();
447430
LinkedList<String> filterList = new LinkedList<>();
@@ -474,7 +457,7 @@ public void testPropertyFilesExtra() throws Exception {
474457
*/
475458
public void testPropertyFilesMainAndExtra() throws Exception {
476459
File testPom = new File(getBasedir(), defaultPomFilePath);
477-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
460+
ResourcesMojo mojo = lookupMojo("resources", testPom);
478461
MavenProjectResourcesStub project = new MavenProjectResourcesStub("resourcePropertyFiles_MainAndExtra");
479462
List<Resource> resources = project.getBuild().getResources();
480463
LinkedList<String> filterList = new LinkedList<>();
@@ -518,7 +501,7 @@ public void testPropertyFilesMainAndExtra() throws Exception {
518501
*/
519502
public void testPropertyFilesFilteringTokensInFilters() throws Exception {
520503
final File testPom = new File(getBasedir(), defaultPomFilePath);
521-
final ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
504+
final ResourcesMojo mojo = lookupMojo("resources", testPom);
522505
final MavenProjectResourcesStub project =
523506
new MavenProjectResourcesStub("resourcePropertyFiles_Filtering_TokensInFilters");
524507
final List<Resource> resources = project.getBuild().getResources();
@@ -550,7 +533,7 @@ public void testPropertyFilesFilteringTokensInFilters() throws Exception {
550533

551534
public void testWindowsPathEscapingDisabled() throws Exception {
552535
File testPom = new File(getBasedir(), defaultPomFilePath);
553-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
536+
ResourcesMojo mojo = lookupMojo("resources", testPom);
554537
MavenProjectResourcesStub project = new MavenProjectResourcesStub("windows-paths");
555538
List<Resource> resources = project.getBuild().getResources();
556539

@@ -586,7 +569,7 @@ public void testWindowsPathEscapingDisabled() throws Exception {
586569

587570
public void testWindowsPathEscapingEnabled() throws Exception {
588571
File testPom = new File(getBasedir(), defaultPomFilePath);
589-
ResourcesMojo mojo = (ResourcesMojo) lookupMojo("resources", testPom);
572+
ResourcesMojo mojo = lookupMojo("resources", testPom);
590573
MavenProjectResourcesStub project = new MavenProjectResourcesStub("windows-paths");
591574
List<Resource> resources = project.getBuild().getResources();
592575

0 commit comments

Comments
 (0)