Skip to content

Commit 728dc31

Browse files
committed
Update all file paths to be relative.
Signed-off-by: Rahul Krishna <i.m.ralk@gmail.com>
1 parent 67a8769 commit 728dc31

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=2.2.0
1+
version=2.2.1

src/main/java/com/ibm/cldk/utils/BuildProject.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,13 @@ public static boolean gradleBuild(String projectPath) {
159159
}
160160

161161
private static boolean buildProject(String projectPath, String build) {
162-
File pomFile = new File(projectPath, "pom.xml");
162+
File pomFile = new File(String.valueOf(Paths.get(projectPath).toAbsolutePath()), "pom.xml");
163163
if (build == null) {
164164
return true;
165165
} else if (build.equals("auto")) {
166166
if (pomFile.exists()) {
167167
Log.info("Found pom.xml in the project directory. Using Maven to build the project.");
168-
return mavenBuild(projectPath); // Use Maven if pom.xml exists
168+
return mavenBuild(Paths.get(projectPath).toAbsolutePath().toString()); // Use Maven if pom.xml exists
169169
} else {
170170
Log.info("Did not find a pom.xml in the project directory. Using Gradle to build the project.");
171171
return gradleBuild(projectPath); // Otherwise, use Gradle
@@ -211,7 +211,7 @@ public static boolean downloadLibraryDependencies(String projectPath, String pro
211211
// created download dir if it does not exist
212212
String projectRoot = projectRootPom != null ? projectRootPom : projectPath;
213213

214-
File pomFile = new File(projectRoot, "pom.xml");
214+
File pomFile = new File((new File(projectRoot)).getAbsoluteFile(), "pom.xml");
215215
if (pomFile.exists()) {
216216
libDownloadPath = Paths.get(projectPath, "target", LIB_DEPS_DOWNLOAD_DIR).toAbsolutePath();
217217
if (mkLibDepDirs(projectPath))
@@ -231,7 +231,7 @@ public static boolean downloadLibraryDependencies(String projectPath, String pro
231231
));
232232
}
233233
Log.info("Found pom.xml in the project directory. Using Maven to download dependencies.");
234-
String[] mavenCommand = {MAVEN_CMD, "--no-transfer-progress", "-f", Paths.get(projectRoot, "pom.xml").toString(), "dependency:copy-dependencies", "-DoutputDirectory=" + libDownloadPath.toString()};
234+
String[] mavenCommand = {MAVEN_CMD, "--no-transfer-progress", "-f", Paths.get(projectRoot, "pom.xml").toAbsolutePath().toString(), "dependency:copy-dependencies", "-DoutputDirectory=" + libDownloadPath.toString()};
235235
return buildWithTool(mavenCommand);
236236
} else if (new File(projectRoot, "build.gradle").exists() || new File(projectRoot, "build.gradle.kts").exists()) {
237237
libDownloadPath = Paths.get(projectPath, "build", LIB_DEPS_DOWNLOAD_DIR).toAbsolutePath();

src/main/java/com/ibm/cldk/utils/ProjectDirectoryScanner.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
public class ProjectDirectoryScanner {
1212
public static List<Path> classFilesStream(String projectPath) throws IOException {
13-
Path projectDir = Paths.get(projectPath);
13+
Path projectDir = Paths.get(projectPath).toAbsolutePath();
1414
Log.info("Finding *.class files in " + projectDir);
1515
if (Files.exists(projectDir)) {
1616
try (Stream<Path> paths = Files.walk(projectDir)) {

0 commit comments

Comments
 (0)