2

我试图让我的程序集(从一个专用的子项目运行)包含由父级聚合的 Javadoc。不幸的是,当我尝试在 moduleSet 中包含父级时,它在装配过程中被忽略,如下所示:

[WARNING] The following patterns were never triggered in this artifact inclusion
filter:
o  'com.company.foo.product:foo-java-product'

我怀疑这是因为父级在技术上不是“模块”,但我想不出任何其他方式来引用父级目标目录中的 javadoc。我从子模块运行程序集的原因是,当从父 pom.xml 运行时,我无法让 dependencySet 工作(实际上与上面的错误类似)。

有人可以推荐一个解决方案吗?

这是我的程序集文件(它已经成功获取了我想要的源代码和依赖项):

<assembly>
  <id>dist</id>
  <formats>
    <format>dir</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <moduleSets>
    <!-- Include Javadoc -->
    <moduleSet>
        <useAllReactorProjects>true</useAllReactorProjects>
        <includes>
            <include>com.company.foo.product:foo-java-product</include>
        </includes>
        <sources>
            <includeModuleDirectory>false</includeModuleDirectory>
            <fileSets>
                <fileSet>
                    <outputDirectory>docs/Javadoc</outputDirectory>
                    <directory>target/site</directory>
                </fileSet>
            </fileSets>
        </sources>
    </moduleSet>
    <!-- Include sources for sample project tests-->
    <moduleSet>
        <useAllReactorProjects>true</useAllReactorProjects>
        <includes>
            <include>com.company.foo.product:samples</include>
        </includes>
        <sources>
            <includeModuleDirectory>false</includeModuleDirectory>
            <fileSets>
                <fileSet>
                    <outputDirectory>source</outputDirectory>
                    <directory>src/test/java</directory>
                    <includes>
                        <include>com/company/foo/samples/Sample*.java</include>
                    </includes>
                </fileSet>
            </fileSets>
        </sources>
    </moduleSet>
  </moduleSets>
  <dependencySets>
    <!-- Include 3rd Party Dependencies -->
    <dependencySet>
        <excludes>
            <exclude>com.company.foo.product:common</exclude>
            <exclude>com.company.foo.product:consumer</exclude>
            <exclude>com.company.foo.product:publisher</exclude>
            <exclude>com.company.foo.product:samples</exclude>
        </excludes>
        <outputDirectory>lib</outputDirectory>
        <useProjectArtifact>false</useProjectArtifact>
    </dependencySet>
  </dependencySets>
</assembly>

这是应用程序分发 pom.xml

<project>
  <parent>
    <groupId>com.company.foo.product</groupId>
    <artifactId>foo-java-product</artifactId>
    <version>0.5-SNAPSHOT</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>app-distribution</artifactId>
  <name>app-distribution</name>
  <packaging>pom</packaging>
  <dependencies>
    <dependency>
        <groupId>com.company.foo.product</groupId>
        <artifactId>consumer</artifactId>
    </dependency>
    <dependency>
        <groupId>com.company.foo.product</groupId>
        <artifactId>publisher</artifactId>
    </dependency>
    <dependency>
        <groupId>com.company.foo.product</groupId>
        <artifactId>samples</artifactId>
    </dependency>
  </dependencies>

  <build>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <descriptors>
                    <descriptor>assemblies/sources.xml</descriptor>
                </descriptors>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
  </build>
</project>

我的父母 pom.xml 看起来像这样:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.company.foo.product</groupId>
  <artifactId>foo-java-product</artifactId>
  <version>0.5-SNAPSHOT</version>
  <packaging>pom</packaging>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>
  <modules>
    <module>Common</module>
    <module>Consumer</module>
    <module>Publisher</module>
    <module>Samples</module>
    <module>app-distribution</module>
  </modules>
  <build>
    <pluginManagement>
        <plugins>
            ...
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.8.1</version>
            <configuration>
                <quiet>true</quiet>
                <stylesheet>maven</stylesheet>
                <splitindex>true</splitindex>

            </configuration>
            <executions>
                <execution>
                    <id>javadoc-jar</id>
                    <phase>package</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <!--
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <descriptors>
                    <descriptor>assemblies/sources.xml</descriptor>
                </descriptors>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        -->
    </plugins>

  </build>
  <dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.company.foo.product</groupId>
            <artifactId>common</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.company.foo.product</groupId>
            <artifactId>publisher</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.company.foo.product</groupId>
            <artifactId>consumer</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.company.foo.product</groupId>
            <artifactId>samples</artifactId>
            <version>${project.version}</version>
        </dependency>
  </dependencyManagement>
</project>
4

0 回答 0