From 38ffa254590324a9743f96faf695eae3594b2f81 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Wed, 8 Jun 2022 09:46:07 +0200 Subject: [PATCH] [MSHARED-1078] Update parent POM and drop maven-shared-utils Update parent POM, project to Java8 and get rid of bad dependency maven-shared-util. --- pom.xml | 54 ++++--------------- .../AbstractArtifactFeatureFilter.java | 11 ++-- .../filter/collection/ScopeFilter.java | 7 +-- .../artifact/filter/internal/Utils.java | 44 +++++++++++++++ 4 files changed, 63 insertions(+), 53 deletions(-) create mode 100644 src/main/java/org/apache/maven/shared/artifact/filter/internal/Utils.java diff --git a/pom.xml b/pom.xml index 009fce2..3560895 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ maven-shared-components org.apache.maven.shared - 34 + 36 @@ -55,49 +55,19 @@ - 3.1.1 - 7 + 3.2.5 + 8 1.6.3 2.22.2 MethodLength 2021-02-14T00:03:59Z - - - - - - - org.apache.maven.plugins - maven-jxr-plugin - 3.0.0 - - - maven-enforcer-plugin - 3.0.0-M3 - - - maven-site-plugin - 3.9.1 - - - maven-project-info-reports-plugin - 3.1.1 - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.2.0 - - - - org.slf4j slf4j-api - 1.7.25 + 1.7.36 @@ -127,7 +97,7 @@ commons-io commons-io - 2.6 + 2.11.0 org.apache.maven.resolver @@ -142,12 +112,6 @@ provided - - org.apache.maven.shared - maven-shared-utils - 3.3.3 - - junit junit @@ -157,13 +121,13 @@ org.mockito mockito-core - 2.28.2 + 4.5.1 test org.apache.maven.plugin-testing maven-plugin-testing-harness - 3.1.0 + 3.3.0 test @@ -175,13 +139,13 @@ org.openjdk.jmh jmh-core - 1.27 + 1.35 test org.openjdk.jmh jmh-generator-annprocess - 1.27 + 1.35 test diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactFeatureFilter.java b/src/main/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactFeatureFilter.java index 916ca23..2a451f4 100644 --- a/src/main/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactFeatureFilter.java +++ b/src/main/java/org/apache/maven/shared/artifact/filter/collection/AbstractArtifactFeatureFilter.java @@ -26,7 +26,8 @@ import java.util.Set; import org.apache.maven.artifact.Artifact; -import org.apache.maven.shared.utils.StringUtils; + +import static org.apache.maven.shared.artifact.filter.internal.Utils.isNotEmpty; /** * This is the common base class of ClassifierFilter and TypeFilter @@ -158,9 +159,9 @@ private Set filterExcludes( Set artifacts, List theE */ public void setExcludes( String excludeString ) { - if ( StringUtils.isNotEmpty( excludeString ) ) + if ( isNotEmpty( excludeString ) ) { - this.excludes = Arrays.asList( StringUtils.split( excludeString, "," ) ); + this.excludes = Arrays.asList( excludeString.split( "," ) ); } } @@ -171,9 +172,9 @@ public void setExcludes( String excludeString ) */ public void setIncludes( String includeString ) { - if ( StringUtils.isNotEmpty( includeString ) ) + if ( isNotEmpty( includeString ) ) { - this.includes = Arrays.asList( StringUtils.split( includeString, "," ) ); + this.includes = Arrays.asList( includeString.split( "," ) ); } } diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/collection/ScopeFilter.java b/src/main/java/org/apache/maven/shared/artifact/filter/collection/ScopeFilter.java index f6b1435..0d44bcc 100644 --- a/src/main/java/org/apache/maven/shared/artifact/filter/collection/ScopeFilter.java +++ b/src/main/java/org/apache/maven/shared/artifact/filter/collection/ScopeFilter.java @@ -25,7 +25,8 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.artifact.resolver.filter.ScopeArtifactFilter; -import org.apache.maven.shared.utils.StringUtils; + +import static org.apache.maven.shared.artifact.filter.internal.Utils.isNotEmpty; /** *

ScopeFilter class.

@@ -63,7 +64,7 @@ public Set filter( Set artifacts ) { Set results = artifacts; - if ( StringUtils.isNotEmpty( includeScope ) ) + if ( isNotEmpty( includeScope ) ) { if ( !Artifact.SCOPE_COMPILE.equals( includeScope ) && !Artifact.SCOPE_TEST.equals( includeScope ) && !Artifact.SCOPE_PROVIDED.equals( includeScope ) && !Artifact.SCOPE_RUNTIME.equals( includeScope ) @@ -91,7 +92,7 @@ public Set filter( Set artifacts ) } } } - else if ( StringUtils.isNotEmpty( excludeScope ) ) + else if ( isNotEmpty( excludeScope ) ) { if ( !Artifact.SCOPE_COMPILE.equals( excludeScope ) && !Artifact.SCOPE_TEST.equals( excludeScope ) && !Artifact.SCOPE_PROVIDED.equals( excludeScope ) && !Artifact.SCOPE_RUNTIME.equals( excludeScope ) diff --git a/src/main/java/org/apache/maven/shared/artifact/filter/internal/Utils.java b/src/main/java/org/apache/maven/shared/artifact/filter/internal/Utils.java new file mode 100644 index 0000000..c3aa289 --- /dev/null +++ b/src/main/java/org/apache/maven/shared/artifact/filter/internal/Utils.java @@ -0,0 +1,44 @@ +package org.apache.maven.shared.artifact.filter.internal; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Utilities. + * + * @since TBD + */ +public final class Utils +{ + private Utils() + { + } + + /** + *

Checks if a String is non null and is + * not empty (length > 0).

+ * + * @param str the String to check + * @return true if the String is non-null, and not length zero + */ + public static boolean isNotEmpty( String str ) + { + return ( ( str != null ) && ( str.length() > 0 ) ); + } +}