我使用公文(1.27)生成rest文档,作为ant构建(1.9.2)的一部分,如下所示:
<enunciate basedir="${java.src.dir}" verbose="true" configfile="${basedir}/enunciate.xml" >
<include name="**/*.java"/>
<classpath refid="test.class.path"/>
<export artifactId="docs" destination="${war.temp.enunciate.dir}"/>
</enunciate>在我转到java 7之前,它一直运行得很好。
...
[enunciate] warning: [options] bootstrap class path not set in conjunction with -source 1.5
...
[enunciate] (use -source 7 or higher to enable try-with-resources)
...我尝试使用javacArgument来指定java 7(使用-source 7和-source 1.7):
<enunciate basedir="${java.src.dir}" verbose="true" configfile="${basedir}/enunciate.xml" >
<include name="**/*.java"/>
<classpath refid="test.class.path"/>
<export artifactId="docs" destination="${war.temp.enunciate.dir}"/>
<javacArgument argument="-source 7"/>
</enunciate>但我得到了以下错误:
invoking enunciate:compile step...
[enunciate] javac: invalid flag: -source 7
[enunciate] Usage: javac <options> <source files>
[enunciate] use -help for a list of possible options下面是我的configfile (enunciate.xml):
<?xml version="1.0"?>
<enunciate label="DocumentCrucible"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.27.xsd">
<deployment host="example.com" context="service"/>
<namespaces>
<namespace id="service" uri="http://example.com/service"/>
<namespace id="bean" uri="http://example.com/bean"/>
</namespaces>
<services>
<rest defaultRestSubcontext="/rest"/>
</services>
<modules>
<docs splashPackage="com.example.rest" title="REST API" copyright="www.example.com"
css="enunciate.css">
</docs>
<java-client>
<package-conversions>
<convert from="com.example" to="com.example.client"/>
</package-conversions>
</java-client>
<jersey disableWildcardServletError="true" disabled="true" ></jersey>
</modules>
</enunciate>看起来,声明的任务是将1.5版本指定到javac,但我无法找到在何处或如何覆盖它。有人知道我做错了什么吗?
我使用公文生成文档,而不是提供rest服务。
发布于 2013-12-05 00:08:40
在1.28 RC2中,有一个选项可以提供-source和-target配置参数:
<enunciate javacSourceVersion="1.7" javacTargetVersion="1.7" ...>
...
</enunciate>http://dist.codehaus.org/enunciate/enunciate-1.28-RC2.zip
发布于 2013-10-05 20:16:29
在查看了源代码之后,org.codehaus.enunciate.main.Enunciate.java将源代码版本硬编码为1.5 (至少在声明的1.27版本中如此)。我看到的唯一解决方案是修改声明的源代码。
https://stackoverflow.com/questions/19189345
复制相似问题