package de.neitzel.fxdesigner.maven; import java.nio.file.*; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.*; import org.apache.maven.project.MavenProject; @Mojo(name = "dependencies", requiresDependencyResolution = ResolutionScope.TEST, threadSafe = true) public final class DependenciesMojo extends AbstractMojo { @Parameter(defaultValue = "${project}", readonly = true, required = true) private MavenProject project; @Parameter(property = "designer.captureDir", required = true) private java.io.File directory; public void execute() throws MojoExecutionException { try { Files.createDirectories(directory.toPath()); try (var out = Files.newOutputStream( directory.toPath().resolve(DependencyProof.id(project) + ".dependencies"))) { DependencyProof.capture(project).store(out, "Dependency identities before compilation"); } } catch (Exception e) { throw new MojoExecutionException("Cannot capture build dependency identities", e); } } }