Skip to content

Commit 888d69a

Browse files
committed
[MSHARED-1301] Upgrade to Parent 42 and Maven 3.6.3
This closes #36
1 parent 1742cb1 commit 888d69a

File tree

57 files changed

+2520
-3640
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2520
-3640
lines changed

pom.xml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version='1.0' encoding='UTF-8'?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
Licensed to the Apache Software Foundation (ASF) under one
44
or more contributor license agreements. See the NOTICE file
@@ -21,9 +21,9 @@
2121
<modelVersion>4.0.0</modelVersion>
2222

2323
<parent>
24-
<artifactId>maven-shared-components</artifactId>
2524
<groupId>org.apache.maven.shared</groupId>
26-
<version>37</version>
25+
<artifactId>maven-shared-components</artifactId>
26+
<version>42</version>
2727
<relativePath />
2828
</parent>
2929

@@ -36,8 +36,8 @@
3636
<scm>
3737
<connection>scm:git:https://gitbox.apache.org/repos/asf/maven-common-artifact-filters.git</connection>
3838
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-common-artifact-filters.git</developerConnection>
39-
<url>https://github.com/apache/maven-common-artifact-filters/tree/${project.scm.tag}</url>
4039
<tag>HEAD</tag>
40+
<url>https://github.com/apache/maven-common-artifact-filters/tree/${project.scm.tag}</url>
4141
</scm>
4242
<issueManagement>
4343
<system>jira</system>
@@ -55,9 +55,9 @@
5555
</distributionManagement>
5656

5757
<properties>
58-
<maven.version>3.2.5</maven.version>
5958
<javaVersion>8</javaVersion>
60-
<resolver.version>1.6.3</resolver.version>
59+
<mavenVersion>3.6.3</mavenVersion>
60+
<resolverVersion>1.4.1</resolverVersion>
6161
<checkstyle.violation.ignore>MethodLength</checkstyle.violation.ignore>
6262
<project.build.outputTimestamp>2022-09-12T19:17:26Z</project.build.outputTimestamp>
6363
</properties>
@@ -72,38 +72,37 @@
7272
<dependency>
7373
<groupId>org.apache.maven</groupId>
7474
<artifactId>maven-artifact</artifactId>
75-
<version>${maven.version}</version>
75+
<version>${mavenVersion}</version>
7676
<scope>provided</scope>
7777
</dependency>
7878
<dependency>
7979
<groupId>org.apache.maven</groupId>
8080
<artifactId>maven-model</artifactId>
81-
<version>${maven.version}</version>
81+
<version>${mavenVersion}</version>
8282
<scope>provided</scope>
8383
</dependency>
8484
<dependency>
8585
<groupId>org.apache.maven</groupId>
8686
<artifactId>maven-core</artifactId>
87-
<version>${maven.version}</version>
87+
<version>${mavenVersion}</version>
8888
<scope>provided</scope>
8989
</dependency>
9090
<dependency>
9191
<groupId>org.apache.maven.resolver</groupId>
9292
<artifactId>maven-resolver-api</artifactId>
93-
<version>${resolver.version}</version>
93+
<version>${resolverVersion}</version>
9494
<scope>provided</scope>
9595
</dependency>
9696
<dependency>
9797
<groupId>org.apache.maven.resolver</groupId>
9898
<artifactId>maven-resolver-util</artifactId>
99-
<version>${resolver.version}</version>
100-
<scope>provided</scope>
99+
<version>${resolverVersion}</version>
101100
</dependency>
102101

103102
<dependency>
104103
<groupId>commons-io</groupId>
105104
<artifactId>commons-io</artifactId>
106-
<version>2.13.0</version>
105+
<version>2.16.1</version>
107106
<scope>test</scope>
108107
</dependency>
109108
<dependency>
Lines changed: 35 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
package org.apache.maven.shared.artifact.filter;
2-
31
/*
42
* Licensed to the Apache Software Foundation (ASF) under one
53
* or more contributor license agreements. See the NOTICE file
@@ -9,7 +7,7 @@
97
* "License"); you may not use this file except in compliance
108
* with the License. You may obtain a copy of the License at
119
*
12-
* http://www.apache.org/licenses/LICENSE-2.0
10+
* http://www.apache.org/licenses/LICENSE-2.0
1311
*
1412
* Unless required by applicable law or agreed to in writing,
1513
* software distributed under the License is distributed on an
@@ -18,15 +16,16 @@
1816
* specific language governing permissions and limitations
1917
* under the License.
2018
*/
19+
package org.apache.maven.shared.artifact.filter;
20+
21+
import java.util.List;
2122

2223
import org.apache.maven.artifact.Artifact;
2324
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
2425
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
2526
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
2627
import org.apache.maven.artifact.versioning.VersionRange;
2728

28-
import java.util.List;
29-
3029
/**
3130
* Filter to include or exclude artifacts from a list of patterns. The artifact pattern syntax is of the form:
3231
*
@@ -44,8 +43,7 @@
4443
*
4544
* @author <a href="mailto:[email protected]">Mark Hobson</a>
4645
*/
47-
public abstract class AbstractStrictPatternArtifactFilter implements ArtifactFilter
48-
{
46+
public abstract class AbstractStrictPatternArtifactFilter implements ArtifactFilter {
4947
// fields -----------------------------------------------------------------
5048

5149
/**
@@ -70,23 +68,19 @@ public abstract class AbstractStrictPatternArtifactFilter implements ArtifactFil
7068
* <code>true</code> to include artifacts that match the patterns, or <code>false</code> to exclude
7169
* them
7270
*/
73-
public AbstractStrictPatternArtifactFilter( List<String> patterns, boolean include )
74-
{
71+
public AbstractStrictPatternArtifactFilter(List<String> patterns, boolean include) {
7572
this.patterns = patterns;
7673
this.include = include;
7774
}
7875

7976
// ArtifactFilter methods -------------------------------------------------
8077

8178
/** {@inheritDoc} */
82-
public boolean include( Artifact artifact )
83-
{
79+
public boolean include(Artifact artifact) {
8480
boolean matched = false;
8581

86-
for ( String pattern : patterns )
87-
{
88-
if ( include( artifact, pattern ) )
89-
{
82+
for (String pattern : patterns) {
83+
if (include(artifact, pattern)) {
9084
matched = true;
9185
break;
9286
}
@@ -99,96 +93,79 @@ public boolean include( Artifact artifact )
9993

10094
/**
10195
* Gets whether the specified artifact matches the specified pattern.
102-
*
96+
*
10397
* @param artifact
10498
* the artifact to check
10599
* @param pattern
106100
* the pattern to match, as defined above
107101
* @return <code>true</code> if the specified artifact is matched by the specified pattern
108102
*/
109-
private boolean include( Artifact artifact, String pattern )
110-
{
103+
private boolean include(Artifact artifact, String pattern) {
111104
String[] tokens = new String[] {
112-
artifact.getGroupId(),
113-
artifact.getArtifactId(),
114-
artifact.getType(),
115-
artifact.getBaseVersion()
105+
artifact.getGroupId(), artifact.getArtifactId(), artifact.getType(), artifact.getBaseVersion()
116106
};
117107

118-
String[] patternTokens = pattern.split( ":" );
108+
String[] patternTokens = pattern.split(":");
119109

120110
// fail immediately if pattern tokens outnumber tokens to match
121111
boolean matched = patternTokens.length <= tokens.length;
122112

123-
for ( int i = 0; matched && i < patternTokens.length; i++ )
124-
{
125-
matched = matches( tokens[i], patternTokens[i] );
113+
for (int i = 0; matched && i < patternTokens.length; i++) {
114+
matched = matches(tokens[i], patternTokens[i]);
126115
}
127116

128117
return matched;
129118
}
130119

131120
/**
132121
* Gets whether the specified token matches the specified pattern segment.
133-
*
122+
*
134123
* @param token
135124
* the token to check
136125
* @param pattern
137126
* the pattern segment to match, as defined above
138127
* @return <code>true</code> if the specified token is matched by the specified pattern segment
139128
*/
140-
private boolean matches( String token, String pattern )
141-
{
129+
private boolean matches(String token, String pattern) {
142130
boolean matches;
143131

144132
// support full wildcard and implied wildcard
145-
if ( "*".equals( pattern ) || pattern.length() == 0 )
146-
{
133+
if ("*".equals(pattern) || pattern.length() == 0) {
147134
matches = true;
148135
}
149136
// support contains wildcard
150-
else if ( pattern.startsWith( "*" ) && pattern.endsWith( "*" ) )
151-
{
152-
String contains = pattern.substring( 1, pattern.length() - 1 );
137+
else if (pattern.startsWith("*") && pattern.endsWith("*")) {
138+
String contains = pattern.substring(1, pattern.length() - 1);
153139

154-
matches = token.contains( contains );
140+
matches = token.contains(contains);
155141
}
156142
// support leading wildcard
157-
else if ( pattern.startsWith( "*" ) )
158-
{
159-
matches = token.endsWith( pattern.substring( 1 ) );
143+
else if (pattern.startsWith("*")) {
144+
matches = token.endsWith(pattern.substring(1));
160145
}
161146
// support trailing wildcard
162-
else if ( pattern.endsWith( "*" ) )
163-
{
164-
String prefix = pattern.substring( 0, pattern.length() - 1 );
147+
else if (pattern.endsWith("*")) {
148+
String prefix = pattern.substring(0, pattern.length() - 1);
165149

166-
matches = token.startsWith( prefix );
150+
matches = token.startsWith(prefix);
167151
}
168-
// support versions range
169-
else if ( pattern.startsWith( "[" ) || pattern.startsWith( "(" ) )
170-
{
171-
matches = isVersionIncludedInRange( token, pattern );
152+
// support versions range
153+
else if (pattern.startsWith("[") || pattern.startsWith("(")) {
154+
matches = isVersionIncludedInRange(token, pattern);
172155
}
173156
// support exact match
174-
else
175-
{
176-
matches = token.equals( pattern );
157+
else {
158+
matches = token.equals(pattern);
177159
}
178160

179161
return matches;
180162
}
181163

182-
private boolean isVersionIncludedInRange( final String version, final String range )
183-
{
184-
try
185-
{
186-
return VersionRange.createFromVersionSpec( range ).containsVersion( new DefaultArtifactVersion( version ) );
187-
}
188-
catch ( InvalidVersionSpecificationException e )
189-
{
164+
private boolean isVersionIncludedInRange(final String version, final String range) {
165+
try {
166+
return VersionRange.createFromVersionSpec(range).containsVersion(new DefaultArtifactVersion(version));
167+
} catch (InvalidVersionSpecificationException e) {
190168
return false;
191169
}
192170
}
193-
194171
}
Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
package org.apache.maven.shared.artifact.filter;
2-
31
/*
42
* Licensed to the Apache Software Foundation (ASF) under one
53
* or more contributor license agreements. See the NOTICE file
@@ -18,6 +16,7 @@
1816
* specific language governing permissions and limitations
1917
* under the License.
2018
*/
19+
package org.apache.maven.shared.artifact.filter;
2120

2221
import java.util.Collection;
2322

@@ -29,17 +28,14 @@
2928
* @author <a href="mailto:[email protected]">Brett Porter</a>
3029
* @see StrictPatternExcludesArtifactFilter
3130
*/
32-
public class PatternExcludesArtifactFilter
33-
extends PatternIncludesArtifactFilter
34-
{
31+
public class PatternExcludesArtifactFilter extends PatternIncludesArtifactFilter {
3532
/**
3633
* <p>Constructor for PatternExcludesArtifactFilter.</p>
3734
*
3835
* @param patterns The pattern to be used.
3936
*/
40-
public PatternExcludesArtifactFilter( Collection<String> patterns )
41-
{
42-
super( patterns );
37+
public PatternExcludesArtifactFilter(Collection<String> patterns) {
38+
super(patterns);
4339
}
4440

4541
/**
@@ -48,34 +44,28 @@ public PatternExcludesArtifactFilter( Collection<String> patterns )
4844
* @param patterns The pattern which will be used.
4945
* @param actTransitively yes/no.
5046
*/
51-
public PatternExcludesArtifactFilter( Collection<String> patterns, boolean actTransitively )
52-
{
53-
super( patterns, actTransitively );
47+
public PatternExcludesArtifactFilter(Collection<String> patterns, boolean actTransitively) {
48+
super(patterns, actTransitively);
5449
}
5550

5651
@Override
57-
public boolean include( Artifact artifact )
58-
{
59-
boolean shouldInclude = !patternMatches( artifact );
52+
public boolean include(Artifact artifact) {
53+
boolean shouldInclude = !patternMatches(artifact);
6054

61-
if ( !shouldInclude )
62-
{
63-
addFilteredArtifact( artifact );
55+
if (!shouldInclude) {
56+
addFilteredArtifact(artifact);
6457
}
6558

6659
return shouldInclude;
6760
}
6861

6962
@Override
70-
protected String getFilterDescription()
71-
{
63+
protected String getFilterDescription() {
7264
return "artifact exclusion filter";
7365
}
7466

7567
@Override
76-
public String toString()
77-
{
68+
public String toString() {
7869
return "Excludes filter:" + getPatternsAsString();
7970
}
80-
8171
}

0 commit comments

Comments
 (0)