1

我使用 Enunciate 作为 API 文档生成的 Maven 插件。我希望压缩生成的文档,但到目前为止还没有找到方法。文档已生成,但在目录中而不是在 zip 文件中。这是我的pom的摘录:

            <plugin>
            <!-- auto-generate docs for REST API -->
            <groupId>org.codehaus.enunciate</groupId>
            <artifactId>maven-enunciate-plugin</artifactId>
            <configuration>
                <configFile>enunciate.xml</configFile>
                <!-- the directory where to put the docs -->
                <docsDir>${project.parent.basedir}/VrmMisc/Docs/SMA_API</docsDir>
                <!-- <docsSubdir>${project.parent.basedir}/VrmMisc/Docs/SMA_API</docsSubdir> -->

            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>docs</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

依赖:

        <dependency>
        <groupId>org.codehaus.enunciate</groupId>
        <artifactId>enunciate-rt</artifactId>
        <version>${enunciate.plugin.version}</version>
        <exclusions>
               <exclusion>
                <artifactId>activation</artifactId>
                <groupId>javax.activation</groupId>
            </exclusion>
            <exclusion>
                <artifactId>enunciate-jaxws-ri-rt</artifactId>
                <groupId>org.codehaus.enunciate</groupId>
            </exclusion>
            <exclusion>
                <artifactId>enunciate-jersey-rt</artifactId>
                <groupId>org.codehaus.enunciate</groupId>
            </exclusion>
            <exclusion>
                <artifactId>jersey-server</artifactId>
                <groupId>com.sun.jersey</groupId>
                </exclusion>
        </exclusions>
    </dependency>

我正在使用 Enunciate 版本 1.26.2。

4

2 回答 2

2

如果您告诉 Enunciate 将“文档”工件“导出”到文件(而不是目录),Enunciate 将为您压缩它:

    <plugin>
        <!-- auto-generate docs for REST API -->
        <groupId>org.codehaus.enunciate</groupId>
        <artifactId>maven-enunciate-plugin</artifactId>
        <configuration>
            <configFile>enunciate.xml</configFile>
            <exports>
                <docs>${project.parent.basedir}/VrmMisc/Docs/SMA_API.zip</docs>
            </exports>
        </configuration>
        <executions>
            <execution>
                <goals>
                    <goal>docs</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
于 2013-07-06T20:07:24.933 回答
0

另一种解决方案是运行 Shell 命令以使 WAR 文件可以轻松部署在 Tomcat 上

#!/bin/bash
filename=enunciate.war
directory=enunciate_directory
echo $filename building starts ...
cd $directory
jar -cf $filename *
于 2014-05-29T12:09:17.137 回答