We need to remove the redundant implementation of getMavenConfiguration in IdeContext:
|
/** |
|
* @return the {@link Path} pointing to the maven configuration directory (where "settings.xml" or "settings-security.xml" are located). |
|
*/ |
|
default Path getMavenConfigurationFolder() { |
|
|
|
Path confPath = getConfPath(); |
|
Path mvnConfFolder = null; |
|
if (confPath != null) { |
|
mvnConfFolder = confPath.resolve(Mvn.MVN_CONFIG_FOLDER); |
|
if (!Files.isDirectory(mvnConfFolder)) { |
|
Path m2LegacyFolder = confPath.resolve(Mvn.MVN_CONFIG_LEGACY_FOLDER); |
|
if (Files.isDirectory(m2LegacyFolder)) { |
|
mvnConfFolder = m2LegacyFolder; |
|
} else { |
|
mvnConfFolder = null; // see fallback below |
|
} |
|
} |
|
} |
|
if (mvnConfFolder == null) { |
|
// fallback to USER_HOME/.m2 folder |
|
mvnConfFolder = getUserHome().resolve(Mvn.MVN_CONFIG_LEGACY_FOLDER); |
|
} |
|
return mvnConfFolder; |
|
} |
And in
Mvn
|
/** |
|
* @param legacy - {@code true} to enforce legacy fallback creation, {@code false} otherwise. |
|
* @return the {@link Path} to the maven configuration folder (where "settings.xml" can be found). |
|
*/ |
|
public Path getMavenConfFolder(boolean legacy) { |
|
|
|
Path confPath = this.context.getConfPath(); |
|
Path mvnConfigFolder = confPath.resolve(MVN_CONFIG_FOLDER); |
|
if (!Files.isDirectory(mvnConfigFolder)) { |
|
Path mvnConfigLegacyFolder = confPath.resolve(Mvn.MVN_CONFIG_LEGACY_FOLDER); |
|
if (Files.isDirectory(mvnConfigLegacyFolder)) { |
|
mvnConfigFolder = mvnConfigLegacyFolder; |
|
} else { |
|
if (legacy) { |
|
mvnConfigFolder = mvnConfigLegacyFolder; |
|
} |
|
this.context.getFileAccess().mkdirs(mvnConfigFolder); |
|
} |
|
} |
|
return mvnConfigFolder; |
|
} |
The implementation in
IdeContext should be replaced by Mvn to follow SoC.
We need to remove the redundant implementation of
getMavenConfigurationinIdeContext:IDEasy/cli/src/main/java/com/devonfw/tools/ide/context/IdeContext.java
Lines 607 to 630 in 0d9b336
And in
MvnIDEasy/cli/src/main/java/com/devonfw/tools/ide/tool/mvn/Mvn.java
Lines 225 to 245 in 0d9b336
The implementation in
IdeContextshould be replaced by Mvn to follow SoC.