从Maven Javadoc插件处理中排除非Java JAR

时间:2017-02-24 13:09:02

标签: maven javadoc

我有一个多模块项目,它构建了几个JAR,然后将它们分配到两个WAR中。

但是,其中一个JAR根本不包含任何Java代码,仅仅是(maven-filtered)资源。这会在构建期间导致警告,如下所示:

[…]
[INFO] --- maven-javadoc-plugin:2.8:jar (attach-javadocs) @ foo-services ---
[INFO] The goal 'org.apache.maven.plugins:maven-javadoc-plugin:2.8:javadoc' has not been previously called for the module: 'de.tarent.foo:foo-rsrcs:jar:1.3.900-SNAPSHOT'. Trying to invoke it...

[WARNING] Creating fake javadoc directory to prevent repeated invocations: /var/lib/jenkins/jobs/FooTool/workspace/foo-backend/foo-rsrcs/target/apidocs
[ERROR] Error fetching link: /var/lib/jenkins/jobs/FooTool/workspace/foo-backend/foo-rsrcs/target/apidocs/package-list. Ignored it.

[INFO] 
Loading source files for package de.tarent.foo.rest.transformation...
[…]

我发现如何通过包排除javadoc的东西,而不是神器。

该插件目前仅包含在父POM中,如下所示:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.8</version>
    <executions>
        <execution>
            <id>attach-javadocs</id>
            <goals>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

虽然 在资源专用JAR的“编译”期间运行,但它(显然)不会产生任何结果,因此警告(因为它也不排除)。

如何让它产生某些东西,或者最好是排除foo-rsrcs模块?

1 个答案:

答案 0 :(得分:-1)

给予这种资源依赖关系,范围runtime应该足以解决此问题。实际上,它对于其他插件也会有更好的效果。