1

我正在使用 enunciate 1.27 和 maven 3.0.4 。
当我多次运行 enunciate 时出现我的问题:

[INFO]
[INFO] --- maven-enunciate-plugin:1.27:assemble (number2) @ yaghut-web ---
[INFO] initializing enunciate.
[INFO] [csharp] C# compilation is disabled, but the source code will still be generated.
[INFO] invoking enunciate:generate step...
An exception has occurred in apt (1.6.0_30). Please file a bug at the Java Developer Connection     (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for     duplicates. Include your program and the following diagnostic in your report.  Thank you.
java.lang.NullPointerException
        at com.sun.tools.apt.comp.Apt$AptTreeScanner.visitAnnotation(Apt.java:161)
        at com.sun.tools.javac.tree.JCTree$JCAnnotation.accept(JCTree.java:1794)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:33)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:41)
        at com.sun.tools.javac.tree.TreeScanner.visitModifiers(TreeScanner.java:266)
        at com.sun.tools.javac.tree.JCTree$JCModifiers.accept(JCTree.java:1816)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:33)
        at com.sun.tools.javac.tree.TreeScanner.visitClassDef(TreeScanner.java:60)
        at com.sun.tools.apt.comp.Apt$AptTreeScanner.visitClassDef(Apt.java:146)
        at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:575)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:33)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:41)
        at com.sun.tools.javac.tree.TreeScanner.visitTopLevel(TreeScanner.java:52)
        at com.sun.tools.apt.comp.Apt$AptTreeScanner.visitTopLevel(Apt.java:124)
        at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:446)
        at com.sun.tools.apt.comp.Apt.main(Apt.java:213)
      ....
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:

我以这种方式执行发音:

<execution>
<id>number1</id>
<goals>
    <goal>assemble</goal>
</goals>
<configuration>
    <configFile>src/main/enunciate_number1.xml</configFile>
    <compilationEncoding>UTF-8</compilationEncoding>
    <generateDir>${project.build.directory}/enunciate/number1/generate</generateDir>
    <compileDir>${project.build.directory}/enunciate/number1/compile</compileDir>
    <buildDir>${project.build.directory}/enunciate/number1/build</buildDir>
</configuration>
</execution>
<execution>
    <id>number2</id>
    <goals>
        <goal>assemble</goal>
    </goals>
    <configuration>
        <configFile>${project.basedir}/src/main/enunciate_number2.xml</configFile>
        <compilationEncoding>UTF-8</compilationEncoding>
        <generateDir>${project.build.directory}/enunciate/number2/generate</generateDir>
        <compileDir>${project.build.directory}/enunciate/number2/compile</compileDir>
        <buildDir>${project.build.directory}/enunciate/number2/build</buildDir>
    </configuration>
</execution>

当我执行一次发音时(我的意思是省略 number2)一切正常。
我猜第二次执行中的“generateDir”设置不正确。当我省略它时,什么都没有生成(消息是:everythis 出现最新的);在当前配置下,会抛出 NullPointerException。

任何想法?
谢谢。

4

1 回答 1

0

我不太了解如何配置 Maven 来实现这一点,但另一种方法可能是使用maven-antrun-plugin来调用 Enunciate 两次,而不是尝试让 Maven 去做。配置看起来有点像第199 行build-site.xml中的“getting-started-examples”目标的内容。

于 2013-09-21T18:15:53.270 回答