首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >阐述自升级到Java 7以来Ant任务的中断

阐述自升级到Java 7以来Ant任务的中断
EN

Stack Overflow用户
提问于 2013-10-04 19:33:23
回答 2查看 1.2K关注 0票数 2

我使用公文(1.27)生成rest文档,作为ant构建(1.9.2)的一部分,如下所示:

代码语言:javascript
复制
<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之前,它一直运行得很好。

代码语言:javascript
复制
...
[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):

代码语言:javascript
复制
<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>

但我得到了以下错误:

代码语言:javascript
复制
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):

代码语言:javascript
复制
<?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服务。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-12-05 00:08:40

在1.28 RC2中,有一个选项可以提供-source和-target配置参数:

代码语言:javascript
复制
<enunciate javacSourceVersion="1.7" javacTargetVersion="1.7"  ...>
  ...
</enunciate>

http://dist.codehaus.org/enunciate/enunciate-1.28-RC2.zip

票数 3
EN

Stack Overflow用户

发布于 2013-10-05 20:16:29

在查看了源代码之后,org.codehaus.enunciate.main.Enunciate.java将源代码版本硬编码为1.5 (至少在声明的1.27版本中如此)。我看到的唯一解决方案是修改声明的源代码。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19189345

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档