简体   繁体   English

构建Ant项目时出现编译错误

[英]Getting compile error while building ant project

I am building this project https://github.com/oracle/visualvm . 我正在建立这个项目https://github.com/oracle/visualvm I have JDK10 in my system. 我的系统中有JDK10。 I changed the source and target option in build xml to 1.8 from 1.5, as there were error saying 1.5 is not supported anymore. 我将build xml中的source和target选项从1.5更改为1.8,因为有错误说不再支持1.5。 Now, I am getting a compile error pointing to common.xml which is in some other sub-folder. 现在,我收到一个编译错误,指向其他子文件夹中的common.xml。

I have no idea, what is wrong as the error log is also very vague. 我不知道这是什么错误,因为错误日志也很模糊。 Also, I am working with Ant for the first time. 另外,我是第一次与Ant合作。

Here is the log. 这是日志。

C:\dev\jvisualvm\visualvm\visualvm\netbeans\harness\suite.xml:163: The following error occurred while executing this line:
C:\dev\jvisualvm\visualvm\visualvm\netbeans\harness\common.xml:200: Compile failed; see the compiler error output for details.
        at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1425)
        at org.netbeans.nbbuild.CustomJavac.compile(CustomJavac.java:102)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:1133)
        at org.netbeans.nbbuild.CustomJavac.execute(CustomJavac.java:83)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
        at org.apache.tools.ant.Task.perform(Task.java:350)
        at org.apache.tools.ant.Target.execute(Target.java:449)
        at org.apache.tools.ant.Target.performTasks(Target.java:470)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
        at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
        at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:306)
        at org.apache.tools.ant.taskdefs.SubAnt.execute(SubAnt.java:225)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
        at org.apache.tools.ant.Task.perform(Task.java:350)
        at org.apache.tools.ant.Target.execute(Target.java:449)
        at org.apache.tools.ant.Target.performTasks(Target.java:470)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1361)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
        at org.apache.tools.ant.Main.runBuild(Main.java:834)
        at org.apache.tools.ant.Main.startAnt(Main.java:223)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)

The part of common.xml where the error is thrown looks like this. 引发错误的common.xml部分看起来像这样。 (nb-javac srcdir tag) (nb-javac srcdir标记)

<target name="compile" depends="init,up-to-date" unless="is.jar.uptodate">
        <mkdir dir="${build.classes.dir}"/>
        <depend srcdir="${src.dir}" destdir="${build.classes.dir}" cache="${build.dir}/depcache">
            <classpath refid="cp"/>
        </depend>
        <property name="javac.fork" value="false"/>
        <nb-javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="${build.compiler.debug}" debuglevel="${build.compiler.debuglevel}" encoding="UTF-8"
                  deprecation="${build.compiler.deprecation}" optimize="${build.compiler.optimize}" source="1.8" target="1.8" includeantruntime="false"
                  fork="false">
            <classpath refid="cp"/>
            <compilerarg line="${javac.compilerargs}"/>
            <processorpath refid="processor.cp"/>
        </nb-javac>
        <copy todir="${build.classes.dir}">
            <fileset dir="${src.dir}" excludes="${jar-excludes}"/>
        </copy>
        <processjsannotation classes="${build.classes.dir}" asm="${asm.jar}">
            <classpath refid="cp"/>
        </processjsannotation>
    </target>

Can anyone point me to some direction to resolve this? 谁能指出我要解决这个问题的方向?

您需要使用JDK 8构建VisualVM。https ://github.com/oracle/visualvm在“ Get the tools部分中明确提到了它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM