Search code examples
mavenmaven-javadoc-plugin

Maven: Disabling javadoc generation for single module inside a multimodule project


I have a large multimodule project and I want to speed up my build.

I've added this inside the build section of the pom.xml (belonging to the module I don't want the javadoc for)

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <executions>
        <execution>
            <id>attach-javadocs</id>
            <goals>
            <goal>jar</goal>
            </goals>
            <configuration>
                    <properties>
                    <maven.javadoc.skip>true</maven.javadoc.skip>
                    </properties>
            </configuration>
        </execution>
    </executions>
</plugin>

But it disables javadoc generation for all of the modules.

My configuration is inside an 'execution' tag so it should not be a global plugin configuration, but appears global?

I'm rather new at configuring Maven, so any recommendations are welcome!


Solution

  • It sometimes is a bit tricky to get rid of inherited configurations.

    You could try adding a property in your pom and give the javadoc-plugin that ${property} as parameter in its configuration. In the one maven module you want to skip the javadoc generation just re-add the property and set it to true.

    It may even be enough to set the maven.javadoc.skip property in the properties section in the one module that should not generate javadocs?