蚂蚁构建无效目标发布中的问题 [英] problem in ant build invalid target release

查看:24
本文介绍了蚂蚁构建无效目标发布中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ant 构建中的问题

[javac] Compiling 86 source files to F:\XXX\classes
    [javac] javac: invalid target release: 1.6
    [javac] Usage: javac <options> <source files>
    [javac] where possible options include:
    [javac]   -g                         Generate all debugging info
    [javac]   -g:none                    Generate no debugging info
    [javac]   -g:{lines,vars,source}     Generate only some debugging info
    [javac]   -nowarn                    Generate no warnings
    [javac]   -verbose                   Output messages about what the compiler is doing
    [javac]   -deprecation               Output source locations where deprecated APIs are used
    [javac]   -classpath <path>          Specify where to find user class files
    [javac]   -cp <path>                 Specify where to find user class files
    [javac]   -sourcepath <path>         Specify where to find input source files
    [javac]   -bootclasspath <path>      Override location of bootstrap class files
    [javac]   -extdirs <dirs>            Override location of installed extensions
    [javac]   -endorseddirs <dirs>       Override location of endorsed standards path
    [javac]   -d <directory>             Specify where to place generated class files
    [javac]   -encoding <encoding>       Specify character encoding used by source files
    [javac]   -source <release>          Provide source compatibility with specified release
    [javac]   -target <release>          Generate class files for specific VM version
    [javac]   -version                   Version information
    [javac]   -help                      Print a synopsis of standard options
    [javac]   -X                         Print a synopsis of nonstandard options
    [javac]   -J<flag>                   Pass <flag> directly to the runtime system


BUILD FAILED

ant 源和目标到 1.6jdk 1.6 的可变路径

ant source and target to 1.6 en variable path to jdk 1.6

推荐答案

您使用的编译器无法通过 -target 1.6 进行编译(javac: invalid target release: 1.6).您确定您使用的是 JDK 1.6 吗?也许蚂蚁安装并使用了JDK 1.5.检查使用的 Java 版本,并在目标中添加以下行(在开头):

You use a compiler that cannot compile with -target 1.6 (javac: invalid target release: 1.6). Are you sure you use the JDK 1.6? Maybe a JDK 1.5 is installed and used by ant. Check the used Java-version with adding following line to your target (at the beginning):

<echo message="Using Java version ${ant.java.version}."/>

它输出 Ant 使用的 Java 版本.

It outputs the Java-version used by Ant.

您可以将编译器设置为使用不同的 Java 版本.您必须使用 fork-attribute 来使用外部 javac 并指定您想要的那个:

You can set the compiler to use a different Java-version. You have to use the fork-attribute to use an external javac and specify which one you want:

<javac srcdir="${src}"
         destdir="${build}"
         fork="yes"
         executable="/opt/java/jdk1.6/bin/javac"
  />

阅读javac-task 的文档了解详情.

Read the documentation of the javac-task for details.

这篇关于蚂蚁构建无效目标发布中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆