Skip to content

Commit ef72e32

Browse files
Copilotquintesse
andcommitted
Optimize 'do' command to only get classpath when ${deps} variable is present
Co-authored-by: quintesse <778793+quintesse@users.noreply.github.com>
1 parent e2028b5 commit ef72e32

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

‎src/main/java/org/codejive/jpm/Main.java‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -368,19 +368,21 @@ public Integer call() throws Exception {
368368
return 1;
369369
}
370370

371-
// Get the classpath for variable substitution using app.yml dependencies
371+
// Get the classpath for variable substitution only if needed
372372
List<Path> classpath = Collections.emptyList();
373-
try {
374-
classpath =
375-
Jpm.builder()
376-
.directory(copyMixin.directory)
377-
.noLinks(copyMixin.noLinks)
378-
.build()
379-
.path(new String[0]); // Empty array means use dependencies from
380-
// app.yml
381-
} catch (Exception e) {
382-
// If we can't get the classpath, continue with empty list
383-
System.err.println("Warning: Could not resolve classpath: " + e.getMessage());
373+
if (command.contains("${deps}")) {
374+
try {
375+
classpath =
376+
Jpm.builder()
377+
.directory(copyMixin.directory)
378+
.noLinks(copyMixin.noLinks)
379+
.build()
380+
.path(new String[0]); // Empty array means use dependencies from
381+
// app.yml
382+
} catch (Exception e) {
383+
// If we can't get the classpath, continue with empty list
384+
System.err.println("Warning: Could not resolve classpath: " + e.getMessage());
385+
}
384386
}
385387

386388
return ScriptUtils.executeScript(command, classpath);

0 commit comments

Comments
 (0)