Skip to content

Commit

Permalink
Added unresolved dependency output
Browse files Browse the repository at this point in the history
  • Loading branch information
Numzskull committed Nov 15, 2021
1 parent 8d087ac commit 8945570
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/main/java/dev/vaziak/mavendd/DependencyResult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package dev.vaziak.mavendd;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.List;

@Getter
@RequiredArgsConstructor
public class DependencyResult {
private final ParsedPom parsedPom;
private final List<ParsedPom.Dependency> unresolvedDependencies;
}
9 changes: 8 additions & 1 deletion src/main/java/dev/vaziak/mavendd/MavenDownloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

@Builder(builderMethodName = "of")
@AllArgsConstructor
Expand All @@ -20,13 +22,15 @@ public class MavenDownloader {
private boolean downloadJavaDocs;
private boolean downloadSources;

public void download() {
public DependencyResult download() {
if (!exportDirectory.exists()) {
if (!exportDirectory.mkdirs()) {
throw new RuntimeException("Failed to create export directory folder.");
}
}

List<ParsedPom.Dependency> unresolvedDependencies = new ArrayList<>();

getParsedPom().getDependencies().forEach(dependency -> {
File file = new File(exportDirectory, dependency.getOutputName());

Expand All @@ -52,6 +56,7 @@ public void download() {
}).findFirst().orElse(null);

if (repository == null) {
unresolvedDependencies.add(dependency);
return;
}

Expand All @@ -61,6 +66,8 @@ public void download() {
e.printStackTrace();
}
});

return new DependencyResult(parsedPom, unresolvedDependencies);
}

public ParsedPom getParsedPom() {
Expand Down

0 comments on commit 8945570

Please sign in to comment.