Skip to content

Find and remove dependencies that come with spring #364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fabapp2 opened this issue Aug 24, 2022 · 5 comments
Open

Find and remove dependencies that come with spring #364

fabapp2 opened this issue Aug 24, 2022 · 5 comments
Assignees

Comments

@fabapp2
Copy link
Contributor

fabapp2 commented Aug 24, 2022

What needs to be done

Example:
A project that gets migrated to Spring Boot could have a dependency to hibernate.
When spring-boot-starter-data-jpa gets added which brings hibernate, then the explicit dependency to hibernate should be found by the Action as "now managed by boot" and removed from the pom.

Implement new action RemoveManagedDependencies

  • Find all dependencies that are transitively pulled in by existing Spring dependencies by reading the poms.
  • Find all explicitly declared dependencies that are also transitively added by Spring
  • If the version is the same or lower, remove the declared dependency and let the application use the transitive dependencies instead

Example

The pom for spring-boot-starter-test defines:

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.8.2</version>
      <scope>compile</scope>
    </dependency>

If the scanned application defines these dependencies

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>2.7.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.8.2</version>
      <scope>test</scope>
    </dependency>

The org.junit.jupiter:junit-jupiter:5.8.2 should be removed.

Additional Information

Excludes must be understood. If in the given example but with this dependency

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>2.7.4</version>
        <scope>test</scope>
        <excludes>
           <exclude>
             <groupId>org.junit.jupiter</groupId>
             <artifactId>junit-jupiter</artifactId>
           </exclude>
        </excludes>
    </dependency>

the recipe should not remove the declared dependency

@fabapp2 fabapp2 changed the title Action finding and removing dependencies that come with spring dependencies Find and remove dependencies that come with spring Aug 24, 2022
@ravig-kant
Copy link
Contributor

ravig-kant commented Aug 30, 2022

Hi @fabapp2

I see action RemoveDependenciesMatchingRegex with hibernate dependencies regex as input. What additional needs to be done for this task?

@ravig-kant
Copy link
Contributor

Hi @fabapp2

A gentle reminder. I can work on this issue if there is more than I stated above.

@fabapp2
Copy link
Contributor Author

fabapp2 commented Oct 8, 2022

Hi @ravig-kant
Sorry for not replying earlier.
It's a bit more complex than just removing dependencies.
I'll update the description.
And I'd be happy if you want to pick this issue?

@ravig-kant
Copy link
Contributor

Hi @fabapp2

Sure, I can pick this up after #455

Ravi

@fabapp2
Copy link
Contributor Author

fabapp2 commented Oct 10, 2022

Hi @fabapp2

Sure, I can pick this up after #455

Ravi

Sounds good, you'll be the dependency-expert then ;)

@fabapp2 fabapp2 assigned fabapp2 and ravig-kant and unassigned fabapp2 Nov 25, 2022
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

No branches or pull requests

2 participants