使用Enunciate生成的压缩文档
问题描述:
我使用Enunciate作为API文档生成的Maven插件。我想要生成的文档被压缩,到目前为止找不到一种方法来做到这一点。文档生成,但在一个目录中,而不是在一个zip文件。 这里是我的聚甲醛的摘录:使用Enunciate生成的压缩文档
<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。
答
如果你告诉字正腔圆“出口”中的“文档”神器到文件(而不是目录)阐明将压缩它为你:
<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>
答
另一种解决方法是将运行Shell命令使WAR文件可以轻松部署到Tomcat上
#!/bin/bash
filename=enunciate.war
directory=enunciate_directory
echo $filename building starts ...
cd $directory
jar -cf $filename *
您是否尝试过将'goal'配置为'assemble'?例如'汇编 ' –