Skip to content

Commit 4e097f8

Browse files
added maven repository cache for faster execution (devonfw#1625)
* added maven repository cache for faster execution * added maven repository cache for faster execution * removed unnecessary else case
1 parent 199c84d commit 4e097f8

File tree

1 file changed

+8
-0
lines changed
  • cobigen/cobigen-core-api/src/main/java/com/devonfw/cobigen/api/util

1 file changed

+8
-0
lines changed

cobigen/cobigen-core-api/src/main/java/com/devonfw/cobigen/api/util/MavenUtil.java

+8
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public class MavenUtil {
4040
/** Logger instance. */
4141
private static final Logger LOG = LoggerFactory.getLogger(MavenUtil.class);
4242

43+
/** Maven repository */
44+
private static Path MAVEN_REPO = null;
45+
4346
/**
4447
* Executes a Maven class path build command which will download all the transitive dependencies needed for the CLI
4548
*
@@ -225,10 +228,15 @@ public static String generatePomFileHash(Path pomFile, Path m2RepoPath) {
225228
*/
226229
public static Path determineMavenRepositoryPath() {
227230

231+
if (MAVEN_REPO != null) {
232+
LOG.debug("Using {} as cached maven repository path.", MAVEN_REPO);
233+
return MAVEN_REPO;
234+
}
228235
Path m2Repo = Paths
229236
.get(runCommand(SystemUtils.getUserHome().toPath(), Lists.newArrayList(SystemUtil.determineMvnPath().toString(),
230237
"help:evaluate", "-Dexpression=settings.localRepository", "-DforceStdout")));
231238
LOG.debug("Determined {} as maven repository path.", m2Repo);
239+
MAVEN_REPO = m2Repo;
232240
return m2Repo;
233241
}
234242

0 commit comments

Comments
 (0)