From fb889549339152a893d7dbb2decc1bfe93c767f6 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 8 Jul 2026 16:16:16 -0700 Subject: [PATCH 1/2] Add support for specifying a local JAR or module using an absolute path --- src/main/java/rife/bld/BaseProject.java | 84 +++++++++++++++++++++---- 1 file changed, 73 insertions(+), 11 deletions(-) diff --git a/src/main/java/rife/bld/BaseProject.java b/src/main/java/rife/bld/BaseProject.java index 4786eed..897e0e4 100644 --- a/src/main/java/rife/bld/BaseProject.java +++ b/src/main/java/rife/bld/BaseProject.java @@ -11,6 +11,8 @@ import rife.bld.operations.*; import rife.tools.FileUtils; import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.*; import java.util.regex.Pattern; @@ -902,12 +904,36 @@ public class BaseProject extends BuildExecutor { *

* If the local dependency points to a directory, it will be scanned for jar files. * - * @param path the file system path of the local dependency + * @param path the file system path (absolute or relative to the {@link #workDirectory}) + * of the local dependency * @since 1.5.2 */ - public LocalDependency local(String path) { return new LocalDependency(path); + } /** + + + /** + * Creates a local dependency instance. + *

+ * If the local dependency points to a directory, it will be scanned for jar files. + * + * @param path the file system path of the local dependency + * @since 2.3.1 + */ + public LocalDependency local(Path path) { + return new LocalDependency(path.toString()); + } + /** + * Creates a local dependency instance. + *

+ * If the local dependency points to a directory, it will be scanned for jar files. + * + * @param path the file system path of the local dependency + * @since 2.3.1 + */ + public LocalDependency local(File path) { + return new LocalDependency(path.getAbsolutePath()); } /** @@ -997,14 +1023,38 @@ public class BaseProject extends BuildExecutor { *

* If the local module points to a directory, it will be scanned for jar files. * - * @param path the file system path of the local module + * @param path the file system path (absolute or relative to the {@link #workDirectory}) + * of the local module * @since 2.1 */ - public LocalModule localModule(String path) { return new LocalModule(path); } + /** + * Creates a local module instance. + *

+ * If the local module points to a directory, it will be scanned for jar files. + * + * @param path the file system path of the local module + * @since 2.3.1 + */ + public LocalModule localModule(Path path) { + return new LocalModule(path.toString()); + } + + /** + * Creates a local module instance. + *

+ * If the local module points to a directory, it will be scanned for jar files. + * + * @param path the file system path of the local module + * @since 2.3.1 + */ + public LocalModule localModule(File path) { + return new LocalModule(path.getAbsolutePath()); + } + /* * Project directories */ @@ -1863,17 +1913,29 @@ public class BaseProject extends BuildExecutor { } private void addLocalJars(List jars, String path) { - var local_file = new File(workDirectory(), path); - if (local_file.exists()) { - if (local_file.isDirectory()) { - var local_jar_files = FileUtils.getFileList(local_file.getAbsoluteFile(), INCLUDED_JARS, EXCLUDED_JARS); - jars.addAll(new ArrayList<>(local_jar_files.stream().map(file -> new File(local_file, file)).toList())); - } else { - jars.add(local_file); + var localPath = Path.of(path); + if (!localPath.isAbsolute()) { + localPath = workDirectory().toPath().resolve(path); + } + + if (!Files.exists(localPath)) { + if (verbose()) { + System.err.println("Invalid local path, skipped: " + path); } + return; + } + + if (Files.isDirectory(localPath)) { + var localJarFiles = FileUtils.getFileList(localPath.toFile(), INCLUDED_JARS, EXCLUDED_JARS); + for (var jar : localJarFiles) { + jars.add(localPath.resolve(jar).toFile()); + } + } else { + jars.add(localPath.toFile()); } } + /** * Returns all the classpath entries for compiling the main sources. *

From 385b0cb2a8ef32867c7054c6d17a623dcf3e7152 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Thu, 9 Jul 2026 09:36:03 -0700 Subject: [PATCH 2/2] Minor cleanups --- src/main/java/rife/bld/BaseProject.java | 26 +++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/rife/bld/BaseProject.java b/src/main/java/rife/bld/BaseProject.java index 897e0e4..63bd0fc 100644 --- a/src/main/java/rife/bld/BaseProject.java +++ b/src/main/java/rife/bld/BaseProject.java @@ -918,7 +918,8 @@ public class BaseProject extends BuildExecutor { *

* If the local dependency points to a directory, it will be scanned for jar files. * - * @param path the file system path of the local dependency + * @param path the file system path (absolute or relative to the {@link #workDirectory}) + * of the local dependency * @since 2.3.1 */ public LocalDependency local(Path path) { @@ -1036,7 +1037,8 @@ public class BaseProject extends BuildExecutor { *

* If the local module points to a directory, it will be scanned for jar files. * - * @param path the file system path of the local module + * @param path the file system path (absolute or relative to the {@link #workDirectory}) + * of the local module * @since 2.3.1 */ public LocalModule localModule(Path path) { @@ -1913,25 +1915,25 @@ public class BaseProject extends BuildExecutor { } private void addLocalJars(List jars, String path) { - var localPath = Path.of(path); - if (!localPath.isAbsolute()) { - localPath = workDirectory().toPath().resolve(path); + var local_path = Path.of(path); + if (!local_path.isAbsolute()) { + local_path = workDirectory().toPath().resolve(path); } - if (!Files.exists(localPath)) { + if (!Files.exists(local_path)) { if (verbose()) { - System.err.println("Invalid local path, skipped: " + path); + System.err.println("Invalid local dependency path, skipped: " + path); } return; } - if (Files.isDirectory(localPath)) { - var localJarFiles = FileUtils.getFileList(localPath.toFile(), INCLUDED_JARS, EXCLUDED_JARS); - for (var jar : localJarFiles) { - jars.add(localPath.resolve(jar).toFile()); + if (Files.isDirectory(local_path)) { + var local_jar_files = FileUtils.getFileList(local_path.toFile(), INCLUDED_JARS, EXCLUDED_JARS); + for (var jar : local_jar_files) { + jars.add(local_path.resolve(jar).toFile()); } } else { - jars.add(localPath.toFile()); + jars.add(local_path.toFile()); } }