[
https://issues.apache.org/jira/browse/MNG-6825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17702190#comment-17702190
]
ASF GitHub Bot commented on MNG-6825:
-------------------------------------
timtebeek commented on PR #1066:
URL: https://github.com/apache/maven/pull/1066#issuecomment-1475047817
Here's a first PR to standardize on Commons-Lang3 StringUtils in Apache
Maven core. It uses the following recipes:
```yaml
type: specs.openrewrite.org/v1beta/recipe
name: com.github.timtebeek.PlexusStringUtilsToCommonsLang3
displayName: Replace Plexus StringUtils with Commons Lang3
description: https://issues.apache.org/jira/browse/MNG-6825
recipeList:
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.codehaus.plexus.util.StringUtils
newFullyQualifiedTypeName: org.apache.commons.lang3.StringUtils
- org.openrewrite.java.ChangeMethodTargetToStatic:
methodPattern: org.codehaus.plexus.util.StringUtils clean(String)
fullyQualifiedTargetTypeName: org.apache.commons.lang3.StringUtils
- org.openrewrite.java.ChangeMethodName:
methodPattern: org.apache.commons.lang3.StringUtils clean(String)
newMethodName: trimToEmpty
- org.openrewrite.java.ChangeType:
oldFullyQualifiedTypeName: org.apache.maven.shared.utils.StringUtils
newFullyQualifiedTypeName: org.apache.commons.lang3.StringUtils
```
Couldn't yet remove the maven-shared/plexus-utils dependencies everywhere,
as there's still references to other classes such as
`org.apache.maven.shared.utils.logging.MessageUtils`, as found through:
[F0jjf.xlsx](https://github.com/apache/maven/files/11009924/F0jjf.xlsx)
```yaml
type: specs.openrewrite.org/v1beta/recipe
name: com.github.timtebeek.MNG-6825
displayName: MNG-6825
description: https://issues.apache.org/jira/browse/MNG-6825
recipeList:
- org.openrewrite.java.search.FindMethods:
methodPattern: org.apache.maven.shared.utils..* *(..)
- org.openrewrite.java.search.FindMethods:
methodPattern: org.codehaus.plexus.util..* *(..)
```
Note that the above recipes are most easily executed by [creating a custom
repository group](https://public.moderne.io/settings/repo-groups), and then
[uploading the yaml into the recipe
builder](https://public.moderne.io/recipes/builder), after which a Dry run
should give results in a couple seconds.
> Cleaning Up dependencies
> plexus-utils/maven-shared-utils/commons-lang3/commons-io
> ---------------------------------------------------------------------------------
>
> Key: MNG-6825
> URL: https://issues.apache.org/jira/browse/MNG-6825
> Project: Maven
> Issue Type: Improvement
> Components: Bootstrap & Build
> Affects Versions: 3.6.3
> Reporter: Karl Heinz Marbaise
> Assignee: Karl Heinz Marbaise
> Priority: Minor
> Fix For: 4.0.x-candidate
>
>
> Experiment to see if we can get rid of commons-lang3 dependency.
> * Identified code duplication between:
> ** {{org.apache.commons.lang3.StringUtils}} from {{commons-lang3}} (501879
> Bytes commons-lang3-3.8.1.jar)
> ** {{org.codehaus.plexus.util.StringUtil}} from {{plexus-utils}} (261801
> Bytes plexus-utils-3.2.1.jar)
> ** {{org.apache.maven.shared.utils}} from {{maven-shared-utils}} (166562
> Bytes maven-shared-utils-3.2.1.jar)
> ** We should replace the self implemented with
> {{org.codehaus.plexus.util.StringUtil}}. or with {{maven-shared-utils}}
> * {{commons-io}} usage by {{maven-shared-utils}} (208700 Bytes
> commons-io-2.5.jar)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)