maven 3 javadoc plugin doesn't take the excludepackagename config
Asked Answered
C

1

8

I'm trying to exclude a bunch of packages from a javadoc site.

Unfortunately this plugin seems to live its own life and when it was configured as a report plugin it failed with access denied when moving files, so it was changed to be a normal plugin and then configured to run with the site goal (aggregated). By doing that we have the javadoc generated and it's published under the site as it should be.

But it seems that the configuration parameters for the plugin doesn't take effect at all. I've tried to move the <excludePackageNames> element around - both being a general config and to be a specific config for the aggregate goal - and I even added an exclusion for our entire code base and all files was still generated.

What I'm trying to do is to simply remove a couple of packages that shouldn't be in the javadoc. Anyone who got this plugin and the config to play nicely, to exclude packages?

This is the config I use right now, the javadoc is created but all packages, including the excluded, is generated.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>2.8</version>
    <configuration>
        <excludePackageNames>my.company.packages.*</excludePackageNames>
    </configuration>
    <executions>
        <!-- Hook up the Javadoc generation on the site phase -->
        <execution>
            <id>aggregate</id>
            <goals>
                <goal>aggregate</goal>
            </goals>
            <phase>site</phase>
        </execution>
    </executions>
</plugin>

Any ideas, pretty please?

Cordiacordial answered 17/1, 2012 at 13:50 Comment(9)
If you got an access denied error then you need to fix the permissions in your tree, not try other experiments at random.Grasshopper
There's no permission to fix, the plugin is holding a file that it tries to move (on any machine or Jenkins server, not only locally). As I wrote it works when configured as a plugin and not as a report plugin. Besides, that is not the main issue. The plugin still doesn't take the config.Cordiacordial
If you can make a test case that demonstrates this problem, open a JIRA at the plugin JIRA and someone, possibly me, will attend to it.Grasshopper
Tried to move the config inside the execution block?Cinerama
I did try to move the config within the block, I found two different examples and tried them both with no succes.Cordiacordial
@bmargulies, I'll see if I can take the time to make a test case.Cordiacordial
The config will work or fail exactly identically in either place. Unless Sven has something funny going on, this is a maven-javadoc-plugin bug, and best handled in JIRA.Grasshopper
@BloodyWorld, yes did that too. That was the "moved around"-part.Cordiacordial
@Sven, are you specifically running the javadoc:javadoc goal from the command line, or are you doing this as part of the overall reactor build (e.g. mvn package or something)? The reason I ask is because the location of the configuration in the POM is different depending on these use cases.Idiocrasy
S
6

I solved identical problem by adding the sourcepath parameter to the configuration:

<configuration>
    <sourcepath>${project.basedir}/src/main/java</sourcepath>
    <excludePackageNames>my.company.packages.*</excludePackageNames>
</configuration>

The configuration above will exclude all packages below my.company.packages but not my.company.packages itself. To exclude also my.company.packages use <excludePackageNames>my.company.packages</excludePackageNames> instead.

Stunk answered 19/5, 2015 at 11:23 Comment(2)
the source-path didn't work for me, when used in the parent.pom of a multi-module project.Touchback
Do you know why the sourcepath is necessary?Mg

© 2022 - 2024 — McMap. All rights reserved.