我使用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。
答案 0 :(得分:2)
如果你告诉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>
答案 1 :(得分:0)
另一个解决方案是运行Shell命令,以便在Tomcat上轻松部署WAR文件
#!/bin/bash
filename=enunciate.war
directory=enunciate_directory
echo $filename building starts ...
cd $directory
jar -cf $filename *