Skip to content
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

#463: Set default Maven m2 repository location back to user home #522

Merged

Conversation

jan-vcapgemini
Copy link
Contributor

@jan-vcapgemini jan-vcapgemini commented Aug 7, 2024

Fixes: #463

Implements:

  • added fallback to USER_HOME for mvn repository
  • added new testMavenRepositoryPathFallsBackToUserHome to MvnTest
  • added environment.properties to mvn test resources (required for proper simulation of USER_HOME)

added new testMavenRepositoryPathFallsBackToUserHome to MvnTest
added environment.properties to mvn test resources (required for proper simulation of USER_HOME)
@jan-vcapgemini jan-vcapgemini self-assigned this Aug 7, 2024
@jan-vcapgemini jan-vcapgemini changed the title #463: added fallback to USER_HOME for mvn repository #463: Set default Maven m2 repository location back to user home Aug 7, 2024
@coveralls
Copy link
Collaborator

coveralls commented Aug 7, 2024

Pull Request Test Coverage Report for Build 10297452655

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.003%) to 62.798%

Files with Coverage Reduction New Missed Lines %
com/devonfw/tools/ide/context/IdeContext.java 4 61.18%
Totals Coverage Status
Change from base Build 10297332150: 0.003%
Covered Lines: 5530
Relevant Lines: 8468

💛 - Coveralls

Copy link
Member

@hohwille hohwille left a comment

Choose a reason for hiding this comment

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

@jan-vcapgemini thanks for your PR. I agree it makes absolutely sense to have M2_REPO always configured instead of using null as fallback. Thanks for the observation and fix 👍

One last thing for getMavenRepository():
I tried to delegate such things to the Mvn commandlet and to avoid redundancies.
IMHO it should be done like this:

  default Path getMavenRepository() {

    if (getIdeHome() != null) {
      Mvn mvn = getCommandletManager().getCommandlet(Mvn.class);
      Path mavenConfFolder = mvn.getMavenConfFolder(true);
      return mavenConfFolder.resolve("repository");
    }
    return null;
  }

Then your fix should go to that Mvn.getMavenConfFolder method as otherwise it is inconsistent. That shows again a good example why such redundancies are evil:
You fix something but are not aware that the same code block was copy&pasted somewhere else where you then miss to apply the fix as well...

@hohwille hohwille merged commit ba83c94 into devonfw:main Aug 8, 2024
3 checks passed
@hohwille hohwille added this to the release:2024.08.001 milestone Aug 8, 2024
@jan-vcapgemini jan-vcapgemini deleted the feature/463-default-mvn-m2-userhome branch August 12, 2024 09:18
@hohwille hohwille added the reviewed Marks PRs that have been presented in the sprint-review meeting or that do not need to be presented. label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reviewed Marks PRs that have been presented in the sprint-review meeting or that do not need to be presented.
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Set default Maven m2 repository location back to user home
3 participants