我有一个有两个通用父级的项目:一个用于普通项目,一个用于模块化项目(扩展了一个用于普通项目的项目)。
我的项目使用模块化父pom并通过设置javadoc:jar
代替<show>private</show>
执行,而不是普通项目的一般父pom中配置的默认 public 。 / p>
但是,即使有效的pom对我来说看起来不错,也无法实现该替代。
我在Github上有一个可复制的示例案例:
正常项目的通用父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/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>
模块化项目的通用父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>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>
项目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>
仅当我在常规项目的通用父pom中将private设置为私有时,生成的javadoc才会包含私有文档。使用JDK8。如何解决此替代问题?不幸的是,我一直在寻找 combine.self 。