You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2024/10/28 17:28:09 UTC
(maven-javadoc-plugin) branch align-with-m-source-p created (now d85b320d)
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a change to branch align-with-m-source-p
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
at d85b320d [MJAVADOC-819] Align archive generation code with Maven Source Plugin
This branch includes the following new commits:
new d85b320d [MJAVADOC-819] Align archive generation code with Maven Source Plugin
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-javadoc-plugin) 01/01: [MJAVADOC-819] Align archive generation code with Maven Source Plugin
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch align-with-m-source-p
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
commit d85b320d9d841401dc9d2c573d69e76e72243750
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Tue Oct 22 23:24:45 2024 +0200
[MJAVADOC-819] Align archive generation code with Maven Source Plugin
This closes #332
---
.../maven/plugins/javadoc/JavadocJarMojo.java | 29 ++++++++++------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocJarMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocJarMojo.java
index f8ec1162..02a1ff99 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocJarMojo.java
@@ -221,23 +221,14 @@ public class JavadocJarMojo extends AbstractJavadocMojo {
* @throws IOException {@link IOException}
*/
private File generateArchive(File javadocFiles, String jarFileName) throws ArchiverException, IOException {
- File javadocJar = new File(jarOutputDirectory, jarFileName);
-
- if (javadocJar.exists()) {
- javadocJar.delete();
- }
-
MavenArchiver archiver = new MavenArchiver();
- archiver.setCreatedBy("Maven Javadoc Plugin", "org.apache.maven.plugins", "maven-javadoc-plugin");
archiver.setArchiver(jarArchiver);
- archiver.setOutputFile(javadocJar);
+ archiver.setCreatedBy("Maven Javadoc Plugin", "org.apache.maven.plugins", "maven-javadoc-plugin");
// configure for Reproducible Builds based on outputTimestamp value
archiver.configureReproducibleBuild(outputTimestamp);
- if (!javadocFiles.exists()) {
- getLog().warn("JAR will be empty - no content was marked for inclusion!");
- } else {
+ if (javadocFiles.exists()) {
archiver.getArchiver().addDirectory(javadocFiles, DEFAULT_INCLUDES, DEFAULT_EXCLUDES);
}
@@ -254,14 +245,20 @@ public class JavadocJarMojo extends AbstractJavadocMojo {
archive.setManifestFile(defaultManifestFile);
}
+ File outputFile = new File(jarOutputDirectory, jarFileName);
+
+ // Why do we do this?
+ if (outputFile.exists()) {
+ outputFile.delete();
+ }
+ archiver.setOutputFile(outputFile);
+
try {
archiver.createArchive(session, project, archive);
- } catch (ManifestException e) {
- throw new ArchiverException("ManifestException: " + e.getMessage(), e);
- } catch (DependencyResolutionRequiredException e) {
- throw new ArchiverException("DependencyResolutionRequiredException: " + e.getMessage(), e);
+ } catch (ManifestException | DependencyResolutionRequiredException e) {
+ throw new ArchiverException("Error creating Javadoc archive: " + e.getMessage(), e);
}
- return javadocJar;
+ return outputFile;
}
}