This repository was archived by the owner on Jun 5, 2025. It is now read-only.
Merged
Conversation
dhoehna
reviewed
Sep 24, 2024
| if (string.Equals(variableName, "MAVEN_OPTS", StringComparison.OrdinalIgnoreCase)) | ||
| { | ||
| var existingValue = Environment.GetEnvironmentVariable(variableName, EnvironmentVariableTarget.User); | ||
| var newValue = (!string.IsNullOrEmpty(existingValue) ? existingValue + " " : string.Empty) + "-Dmaven.repo.local = " + value; |
Contributor
There was a problem hiding this comment.
NIT: Consider making -Dmaven.repo.local = a const string in a common location. #WontFix
dhoehna
approved these changes
Sep 24, 2024
kanismohammed
approved these changes
Sep 27, 2024
dhoehna
reviewed
Sep 30, 2024
| private void UpdateSettingsXML(string localRepositoryLocation) | ||
| { | ||
| int index = ExistingCacheLocation.IndexOf("repository", StringComparison.OrdinalIgnoreCase); | ||
| var settingsXMLPath = string.Concat(this.ExistingCacheLocation.AsSpan(0, index), "settings.xml"); |
dhoehna
reviewed
Sep 30, 2024
|
|
||
| private void UpdateSettingsXML(string localRepositoryLocation) | ||
| { | ||
| int index = ExistingCacheLocation.IndexOf("repository", StringComparison.OrdinalIgnoreCase); |
Contributor
There was a problem hiding this comment.
What if -1 is returned? #ByDesign
Contributor
Author
There was a problem hiding this comment.
This code won't execute if index is -1 here. So we are good.
dhoehna
reviewed
Sep 30, 2024
| if (File.Exists(settingsXMLPath)) | ||
| { | ||
| // Update settings.xml with the new repository path | ||
| UpdateOrCreateSubkey(settingsXMLPath, key, subkey, localRepositoryLocation); |
Contributor
There was a problem hiding this comment.
Comment says Update... but the method name is UpdateOrCreate please update the comment. #ByDesign
Contributor
Author
There was a problem hiding this comment.
It updates or creates the subkey, not the file itself.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the pull request
Dev drive documentation initially suggested moving all contents of %userprofile%/.m2 to dev drive for optimization. However we only need to move contents of %userprofile%/.m2/repository to dev drive and set MAVEN_OPTS="-Dmaven.repo.local=<dev drive location for .m2\repository>"
References and relevant issues
#3336
Detailed description of the pull request / Additional comments
Validation steps performed
Manual tests. Tested with real Maven cache and repository.