Jonas
Jonas

Reputation: 860

Maven Assembly: Introduce java doc from a separate project

I have an assembly descriptor to generate a separate package for our documentation, including the javadoc. It contains the following to include generated javadoc from the same project it's running in (assembly is a subproject from core):

<fileSet>
    <directory>../core/target/site/apidocs</directory>
    <outputDirectory>javadoc</outputDirectory>
    <includes>
        <include>**/*</include>
    </includes>
</fileSet>

But how can I include java doc from a completely separate project which I do not know the path on the file system to, just have the .m2 repo let's say. I have tried the following but it does not seem to do anything:

<dependencySets>
    <dependencySet>
        <includes>
            <include>com.company:company-utils:*:javadoc</include>
        </includes>
        <outputDirectory>apidocs-util</outputDirectory>
        <unpack>true</unpack>
    </dependencySet>
</dependencySets>

Any ideas appreciated.

Thanks

Jonas

Upvotes: 1

Views: 564

Answers (2)

Raghuram
Raghuram

Reputation: 52665

Assuming the javadoc of the project that you are interested has been installed/deployed to local/remote repository, you can get it into your assembly by adding it as a dependency in your pom with javadoc as <classifier>.

    <dependency>
        <groupId>com.company</groupId>
        <artifactId>company-utils</artifactId>
        <version>1.0-SNAPSHOT</version>
        <classifier>javadoc</classifier>
    </dependency>

The following snippet in the assembly descriptor (without the classifier) worked for me.

<dependencySets>
    <dependencySet>
        <includes>
            <include>com.company:company-utils</include>
        </includes>
        <outputDirectory>apidocs-util</outputDirectory>
        <unpack>true</unpack>
    </dependencySet>
</dependencySets>

Upvotes: 1

khmarbaise
khmarbaise

Reputation: 97477

Why would you like to create the javadoc within a different project than the current one. It is created during the default release cycle. So need to make a separate assembly for that. Or if you think you need something supplemental apart from the javadoc check the documentation for the maven-javadoc-plugin

BTW: Never make packaging from a different package than your own, cause that will produce trouble.

Upvotes: 0

Related Questions