Skip to content

Maven Plugin

Kostiantyn Shchepanovskyi edited this page Feb 24, 2016 · 6 revisions

Generate HTML documentation

Simple project with single module

This is the most trivial case: you have single maven module with proto files and java files in one place. Assume that proto files are stored in ${project.basedir}/src/main/proto. Then configuration should look like this:

    <build>
        <plugins>
            <plugin>
                <groupId>io.protostuff</groupId>
                <artifactId>protostuff-maven-plugin</artifactId>
                <version>2.0.0-alpha1</version>
                <executions>
                    <execution>
                        <id>html</id>
                        <goals>
                            <goal>html</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

Plugin defaults:

Option Default value
source Depends on phase: src/main/proto for generate-sources and src/test/proto for generate-test-sources
target ${project.build.directory}/generated-html

Complex and multi-module projects

If proto files (all or some part) are not stored in the same maven module where you run documentation generator plugin, then you should make small pre-processing before running plugin.

Example: proto files are stored in two different maven modules. In this case we use maven-dependency-plugin to prepare directory with proto files - ${tmpSourceDirectory} - for protostuff plugin :

<plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.10</version>
    <executions>
        <execution>
            <phase>prepare-package</phase>
            <goals>
                <goal>unpack</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <artifactItems>
            <artifactItem>
                <groupId>com.playtech.live.dls</groupId>
                <artifactId>dls-protocol-da</artifactId>
                <version>${project.version}</version>
                <outputDirectory>${tmpSourceDirectory}</outputDirectory>
                <includes>**/*.proto</includes>
            </artifactItem>
            <artifactItem>
                <groupId>com.playtech.live.dls</groupId>
                <artifactId>dls-protocol-terminal</artifactId>
                <version>${project.version}</version>
                <outputDirectory>${tmpSourceDirectory}</outputDirectory>
                <includes>**/*.proto</includes>
            </artifactItem>
        </artifactItems>
    </configuration>
</plugin>

Then:

<plugin>
    <groupId>io.protostuff</groupId>
    <artifactId>protostuff-maven-plugin</artifactId>
    <version>2.0.0-alpha1</version>
    <executions>
        <execution>
            <id>html</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>html</goal>
            </goals>
            <configuration>
                <source>${tmpSourceDirectory}</source>
            </configuration>
        </execution>
    </executions>
</plugin>
Clone this wiki locally