From a3b744cb1190f9041f3ac92abcd4314bab9bfab4 Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sun, 22 Nov 2026 19:24:45 +0100 Subject: [PATCH] Run javadoc in the javadoc IT The IT ran clean and test, so its maven-javadoc-plugin configuration was never used and the generated sources were only compiled. It now runs javadoc:javadoc, with the plugin version from the build, and checks that the pages and the linked source of a generated class exist. --- modello-maven-plugin/pom.xml | 1 + .../src/it/javadoc/invoker.properties | 1 + modello-maven-plugin/src/it/javadoc/pom.xml | 2 +- modello-maven-plugin/src/it/javadoc/verify.groovy | 12 ++++++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 modello-maven-plugin/src/it/javadoc/invoker.properties create mode 100644 modello-maven-plugin/src/it/javadoc/verify.groovy diff --git a/modello-maven-plugin/pom.xml b/modello-maven-plugin/pom.xml index 01cc7dfe2..c60e5fcb3 100644 --- a/modello-maven-plugin/pom.xml +++ b/modello-maven-plugin/pom.xml @@ -210,6 +210,7 @@ ${version.junit5} ${java.version} ${jdom.version} + ${version.maven-javadoc-plugin} clean diff --git a/modello-maven-plugin/src/it/javadoc/invoker.properties b/modello-maven-plugin/src/it/javadoc/invoker.properties new file mode 100644 index 000000000..8e0e8d30f --- /dev/null +++ b/modello-maven-plugin/src/it/javadoc/invoker.properties @@ -0,0 +1 @@ +invoker.goals = clean javadoc:javadoc diff --git a/modello-maven-plugin/src/it/javadoc/pom.xml b/modello-maven-plugin/src/it/javadoc/pom.xml index 7bb293cab..de2714a90 100644 --- a/modello-maven-plugin/src/it/javadoc/pom.xml +++ b/modello-maven-plugin/src/it/javadoc/pom.xml @@ -38,7 +38,7 @@ maven-javadoc-plugin - 3.2.0 + @javadocPluginVersion@ private true diff --git a/modello-maven-plugin/src/it/javadoc/verify.groovy b/modello-maven-plugin/src/it/javadoc/verify.groovy new file mode 100644 index 000000000..3f54dc32f --- /dev/null +++ b/modello-maven-plugin/src/it/javadoc/verify.groovy @@ -0,0 +1,12 @@ +// javadoc:javadoc must document the generated sources, including the private members (show = private) +// and link to the source (linksource); the output directory depends on the Maven version +String model = "org/plexus/modello/demo/model/Root.html" +List pages = [] +new File(basedir, "target").eachFileRecurse { f -> + pages << f.path.replace(File.separator, "/") +} + +List apiPages = pages.findAll { it.endsWith("/apidocs/" + model) } +assert apiPages.size() == 1 : "Expected one javadoc page for Root, found " + apiPages +assert new File(apiPages[0]).getText("UTF-8").contains("simpleField") : "javadoc of Root does not describe simpleField" +assert pages.any { it.endsWith("/apidocs/src-html/" + model) } : "javadoc did not link the source of Root"