问题
I have a project with two generic parents: one for normal projects and one for modular projects (which extends the one for normal projects).
My project uses the modular parent pom and overrides the javadoc:jar
execution by setting <show>private</show>
instead of the default public as configured in the generic parent pom for normal projects.
However, the override is not honored, even though the effective-pom that it looks good to me.
I've an reproducible example case of this on Github:
- https://github.com/bbottema/javadoc-problem-case
Generic parent pom for normal projects:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.bbottema</groupId>
<artifactId>standard-project-parent</artifactId>
<packaging>pom</packaging>
<name>standard-project-parent</name>
<version>1.0.11-SNAPSHOT</version>
<properties>
<java.version>1.7</java.version>
<compiler.encoding>UTF-8</compiler.encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<doclint>all,-missing</doclint>
<show>public</show>
<nohelp>true</nohelp>
<detectOfflineLinks>false</detectOfflineLinks>
<excludePackageNames>*.internal:*.internal.*:testutil:demo</excludePackageNames>
<quiet>true</quiet>
<failOnError>false</failOnError>
</configuration>
<executions>
<execution>
<id>jar</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${compiler.encoding}</encoding>
<compilerArgument>-Xlint:all</compilerArgument>
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
</plugins>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Generic parent pom for modular projects:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.bbottema</groupId>
<artifactId>standard-project-parent</artifactId>
<version>1.0.11-SNAPSHOT</version>
</parent>
<artifactId>modular-project-parent</artifactId>
<packaging>pom</packaging>
<name>modular-project-parent</name>
<version>1.0.12-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>aggregate-jar</id>
<goals>
<goal>aggregate-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Project pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.bbottema</groupId>
<artifactId>modular-project-parent</artifactId>
<version>1.0.12-SNAPSHOT</version>
</parent>
<artifactId>module-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>Master pom</name>
<modules>
<module>modules/module-a</module>
<module>modules/module-b</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>jar</id>
<configuration>
<show>private</show>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Only if I set private in the generic parent pom for normal projects, will the generated javadoc contain private docs. Using JDK8. How do I fix this override? I was looking into combine.self with no luck unfortunately.
来源:https://stackoverflow.com/questions/59335821/javadoc-plugin-config-override-not-working-in-modular-project