You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2011/01/13 04:02:35 UTC

DO NOT REPLY [Bug 50578] New: Javac task failes when the "target" attribute is specified as 1.1.

https://issues.apache.org/bugzilla/show_bug.cgi?id=50578

           Summary: Javac task failes when the "target" attribute is
                    specified as 1.1.
           Product: Ant
           Version: 1.8.2
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: tadashi.maemura@nts.ricoh.co.jp


With Ant 1.8.2, Javac task failes when the "target" attribute is specified as
1.1 and source
attribute is not specified.

Exsample of build.xml.
------------------------------------------------------------------------
<?xml version="1.0"?>

<project default="compile">

  <target name="compile">
    <javac destdir = "classes" srcdir = "src" target = "1.1"/>
  </target>

</project>
------------------------------------------------------------------------


Running the build.xml. (Version of javac is 1.6.0_22.)
------------------------------------------------------------------------
% ant
Buildfile: build.xml

compile:
    [javac] build.xml:6: warning: 'includeantruntime' was not set, defaulting
to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 1 source file to classes
    [javac]
    [javac]           WARNING
    [javac]
    [javac] The -source switch defaults to 1.5 in JDK 1.5 and 1.6.
    [javac] If you specify -target 1.2 you now must also specify -source 1.1.
    [javac] Ant will implicitly add -source 1.1 for you.  Please change your
build file.
    [javac] javac: invalid source release: 1.1
    [javac] Usage: javac <options> <source files>
    [javac] use -help for a list of possible options

BUILD FAILED
build.xml:6: Compile failed; see the compiler error output for details.
------------------------------------------------------------------------

Please note that the target attribute value is shown as 1.2.

I investigated the problem:  in
org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter, 
setImplicitSourceSwitch method is in called as following.

setImplicitSourceSwitch(
    (assumeJava15() || assumeJava16()) ? "1.5 in JDK 1.5 and 1.6" : "1.7 in JDK
1.7",
        cmd,
    s,
    t);

But, setImplicitSourceSwitch method is declared as following.

private void setImplicitSourceSwitch(
    String defaultDetails,
    Commandline cmd,
    String target,
    String source) 

Please note the orders of "target" and "source": the call above passes
parameters in wrong order.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 50578] Javac task failes when the "target" attribute is specified as 1.1.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=50578

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |1.8.3

--- Comment #1 from Stefan Bodewig <bo...@apache.org> 2011-01-14 00:16:08 EST ---
mea culpa.

Fixed with svn revision 1058854

The real solution for you is to avoid any implicit manipulations by Ant and
specify source explicitly as well (likely as 1.3).

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.