我正在使用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>我使用的是版本1.26.2的表述。
发布于 2013-07-07 04:07:25
如果您告诉Enunciate将"docs“工件”导出“到一个文件(而不是一个目录)中,则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>发布于 2014-05-29 20:09:17
另一种解决方案是运行Shell命令,使WAR文件可以轻松地部署到Tomcat上
#!/bin/bash
filename=enunciate.war
directory=enunciate_directory
echo $filename building starts ...
cd $directory
jar -cf $filename *https://stackoverflow.com/questions/17082801
复制相似问题