Skip to content

[MNG-6825] Consistently use commons-lang3 StringUtils#1066

Closed
timtebeek wants to merge 8 commits intoapache:masterfrom
timtebeek:refactor/replace-plexus-string-utils-with-commons-lang-3
Closed

[MNG-6825] Consistently use commons-lang3 StringUtils#1066
timtebeek wants to merge 8 commits intoapache:masterfrom
timtebeek:refactor/replace-plexus-string-utils-with-commons-lang-3

Conversation

@timtebeek
Copy link
Copy Markdown
Contributor

For: https://issues.apache.org/jira/browse/MNG-6825

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [MNG-XXX] SUMMARY,
    where you replace MNG-XXX and SUMMARY with the appropriate JIRA issue.
  • Also format the first line of the commit message like [MNG-XXX] SUMMARY.
    Best practice is to use the JIRA issue title in both the pull request title and in the first line of the commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@timtebeek
Copy link
Copy Markdown
Contributor Author

Here's a first PR to standardize on Commons-Lang3 StringUtils in Apache Maven core. It uses the following recipes:

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

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, and then uploading the yaml into the recipe builder, after which a Dry run should give results in a couple seconds.

Comment thread maven-xml-impl/pom.xml
Comment thread maven-compat/pom.xml
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was removed in 703f814, restored as per this thread, and similar for maven-embedder below. Not a net-new dependency, but explicit direct dependency that also comes in transitively.

@timtebeek timtebeek requested a review from gnodet March 19, 2023 20:45
@timtebeek
Copy link
Copy Markdown
Contributor Author

Resolved the conflicts after 54afd17 ; Think this is good to go.

@timtebeek
Copy link
Copy Markdown
Contributor Author

@elharo Since you've offered to review MNG-6825 ; are you able to see this through as well? This is a more extensive change as opposed to 8421a36 , as this also introduces the dependency where is was not present before, reflecting the approach set out in MNG-6825.

@gnodet
Copy link
Copy Markdown
Contributor

gnodet commented Apr 13, 2023

I think this one can be closed now.

@gnodet gnodet closed this Apr 13, 2023
@timtebeek timtebeek deleted the refactor/replace-plexus-string-utils-with-commons-lang-3 branch April 13, 2023 09:57
@jira-importer
Copy link
Copy Markdown

Resolve #8219

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants