diff --git a/plugins/autodoc/autodoc-plugin/src/main/java/org/eclipse/edc/plugins/autodoc/tasks/AbstractManifestResolveTask.java b/plugins/autodoc/autodoc-plugin/src/main/java/org/eclipse/edc/plugins/autodoc/tasks/AbstractManifestResolveTask.java index 22e7ba1..3d41fc0 100644 --- a/plugins/autodoc/autodoc-plugin/src/main/java/org/eclipse/edc/plugins/autodoc/tasks/AbstractManifestResolveTask.java +++ b/plugins/autodoc/autodoc-plugin/src/main/java/org/eclipse/edc/plugins/autodoc/tasks/AbstractManifestResolveTask.java @@ -18,6 +18,8 @@ import org.gradle.api.DefaultTask; import org.gradle.api.artifacts.Dependency; import org.gradle.api.tasks.Internal; +import org.gradle.api.tasks.OutputDirectory; +import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.options.Option; @@ -76,6 +78,11 @@ public void setOutput(String output) { this.outputDirectoryOverride = new File(output); } + @OutputDirectory + public File getOutputFile() { + return downloadDirectory.toFile(); + } + /** * Whether to consider a particular dependency for manifest resolution. * diff --git a/plugins/autodoc/autodoc-plugin/src/main/java/org/eclipse/edc/plugins/autodoc/tasks/DownloadManifestTask.java b/plugins/autodoc/autodoc-plugin/src/main/java/org/eclipse/edc/plugins/autodoc/tasks/DownloadManifestTask.java index 5a2e56e..d879e64 100644 --- a/plugins/autodoc/autodoc-plugin/src/main/java/org/eclipse/edc/plugins/autodoc/tasks/DownloadManifestTask.java +++ b/plugins/autodoc/autodoc-plugin/src/main/java/org/eclipse/edc/plugins/autodoc/tasks/DownloadManifestTask.java @@ -18,7 +18,9 @@ import org.gradle.api.artifacts.ProjectDependency; import org.gradle.api.artifacts.repositories.MavenArtifactRepository; import org.gradle.api.internal.artifacts.dependencies.DefaultProjectDependency; +import org.gradle.api.tasks.OutputFile; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URI; @@ -48,7 +50,6 @@ protected InputStream resolveManifest(DependencySource autodocManifest) { getLogger().warn("Could not obtain {}", autodocManifest.dependency()); return null; } - return inputStream; } @@ -122,6 +123,4 @@ private boolean isLocalFileValid(Dependency dep) { throw new RuntimeException(e); } } - - } diff --git a/plugins/autodoc/autodoc-plugin/src/main/java/org/eclipse/edc/plugins/autodoc/tasks/FileSource.java b/plugins/autodoc/autodoc-plugin/src/main/java/org/eclipse/edc/plugins/autodoc/tasks/FileSource.java index 47e637c..9e6771a 100644 --- a/plugins/autodoc/autodoc-plugin/src/main/java/org/eclipse/edc/plugins/autodoc/tasks/FileSource.java +++ b/plugins/autodoc/autodoc-plugin/src/main/java/org/eclipse/edc/plugins/autodoc/tasks/FileSource.java @@ -7,6 +7,8 @@ import java.io.FileNotFoundException; import java.io.InputStream; import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; /** * A dependency that is represented in the local file system, e.g. the local Maven cache @@ -24,7 +26,7 @@ public FileSource(Dependency dependency, URI uri, String classifier, String type @Override public boolean exists() { - return new File(uri()).exists(); + return Files.exists(Path.of(uri())); } @Override