1

我正在尝试通过一个可以在 Jenkins 中执行的命令为我的多模块项目构建一个完整的站点。但是,当我构建它时,子模块 javadocs 出现在站点根目录中(站点/apidocs 而不是站点/子模块/apidocs)。从父模块到子模块的所有链接也都断开了。

组织是标准

pom.xml
submodule/pom.xml

父 POM 包含:

<build>
    <pluginManagement>
        <plugins>
            ... Various unrelated plugins ...
        </plugins>
    </pluginManagement>
</build>

<profiles>
    <profile>
        <id>complete-build</id>
        <build>
            <plugins>
                <!--JavaDoc setup for Jars-->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.9.1</version>
                    <configuration>
                        <defaultAuthor>Leon Blakey</defaultAuthor>
                        <defaultVersion>${project.version}</defaultVersion>
                        <sourcepath>target/delombok</sourcepath>
                    </configuration>
                </plugin>
                <!--Deploy site with Mercurial (Hg)-->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.3</version>
                    <dependencies>
                        <dependency><!-- add support for scm -->
                            <groupId>org.apache.maven.wagon</groupId>
                            <artifactId>wagon-scm</artifactId>
                            <version>2.4</version>
                        </dependency>
                        <dependency>
                            <groupId>org.apache.maven.scm</groupId>
                            <artifactId>maven-scm-provider-hg</artifactId>
                            <version>1.8.1</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <reportPlugins>
                            <!--JavaDoc setup for Site-->
                            <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-javadoc-plugin</artifactId>
                                <version>2.9.1</version>
                                <configuration>
                                    <defaultAuthor>Leon Blakey</defaultAuthor>
                                    <defaultVersion>${project.version}</defaultVersion>
                                    <sourcepath>target/delombok</sourcepath>
                                    <show>public</show>
                                </configuration>
                            </plugin>
                            ... Checkstyle, PMD, Findbugs, etc ...
                        </reportPlugins>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

子模块 POM 仅包含 pluginManagement 的骨架插件定义。

当我尝试构建一个站点(在我的本地机器和 Jenkins 上)时,我从父级运行

 mvn clean install site-deploy -Pcomplete-build

通过上述设置,什么会导致子模块将其站点文件转储到站点根目录 (site/) 而不是子模块目录 (site/submodule) 中?我是否需要使用 staging 命令(我避免使用它,因为它会破坏发布过程)?是否根本不可能在一个命令中构建一个多模块站点?

4

1 回答 1

0

Use the maven-reactor-plugin to trigger building at the submodule level.

于 2014-01-24T08:43:30.607 回答