使用maven发出多次运行时间

时间:2013-09-16 07:53:42

标签: maven-3 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:

我以这种方式执行enunciate:

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

当我执行一次(我的意思是省略数字2)时,一切都正常工作 我猜测第二次执行中的'generateDir'设置不正确。当我省略它时,没有生成任何内容(消息是:每个都显示为最新的);并且使用当前配置,抛出NullPointerException。

任何想法?
感谢。

1 个答案:

答案 0 :(得分:0)

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