Domanda

I use enunciate (1.27) to generate rest documentation as part of an ant build (1.9.2), as follows:

<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>

This was working just fine until I moved to java 7. Since then, I get:

...
[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)
...

I have tried using javacArgument to specify java 7 (using -source 7 and -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>

But I get the following error:

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

Here's my 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>

It looks like the enunciate task is specifying version 1.5 to javac, but I can't find where or how to override it. Anyone know what I'm doing wrong?

I'm using enunciate to generate documentation, not provide the rest services.

È stato utile?

Soluzione

As of 1.28 RC2, there is an option to provide -source and -target configuration parameters:

<enunciate javacSourceVersion="1.7" javacTargetVersion="1.7"  ...>
  ...
</enunciate>

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

Altri suggerimenti

Having had a look at the source, org.codehaus.enunciate.main.Enunciate.java hard-codes the source version as 1.5 (at least in version 1.27 of Enunciate). The only solution I can see is to modify the source code of enunciate.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top