Hadoop Common
  1. Hadoop Common
  2. HADOOP-4503

ant jar when run for first time does not inclue version information

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: build
    • Labels:
    • Environment:

      linux builds and windows builds

      Description

      Ant jar when run for first time does not include version information.

      1. antfile1
        1 kB
        Sreekanth Ramakrishnan
      2. antfile
        72 kB
        Sreekanth Ramakrishnan

        Issue Links

          Activity

          Sreekanth Ramakrishnan created issue -
          Hide
          Sreekanth Ramakrishnan added a comment -

          When you run ant jar on the current hadoop trunk the package-info.java which is autogenerated does not get included in the list of the classes which are packaged.

          Marking this as major because, the behaviour causes issues when you are using HOD, which checks the version information while deploying custom tar ball on the nodes.

          Also attaching the output from ant jar with compile-core-classes target modified to include to display list of files which are being compiled.

          Show
          Sreekanth Ramakrishnan added a comment - When you run ant jar on the current hadoop trunk the package-info.java which is autogenerated does not get included in the list of the classes which are packaged. Marking this as major because, the behaviour causes issues when you are using HOD, which checks the version information while deploying custom tar ball on the nodes. Also attaching the output from ant jar with compile-core-classes target modified to include to display list of files which are being compiled.
          Hide
          Sreekanth Ramakrishnan added a comment -

          Attaching output from ant jar, the first file displays the first iteration of the ant jar being run, the package-info.java is not compiled. In second version you can see the list of other files which are getting attached.

          Show
          Sreekanth Ramakrishnan added a comment - Attaching output from ant jar, the first file displays the first iteration of the ant jar being run, the package-info.java is not compiled. In second version you can see the list of other files which are getting attached.
          Sreekanth Ramakrishnan made changes -
          Field Original Value New Value
          Attachment antfile [ 12392704 ]
          Attachment antfile1 [ 12392705 ]
          Hide
          Sreekanth Ramakrishnan added a comment -

          Also attaching the svn info for the workspace which the build has happened.

          Path: .
          URL: http://svn.apache.org/repos/asf/hadoop/core/trunk
          Repository Root: http://svn.apache.org/repos/asf
          Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
          Revision: 707297
          Node Kind: directory
          Schedule: normal
          Last Changed Author: acmurthy
          Last Changed Rev: 707262
          Last Changed Date: 2008-10-23 09:29:20 +0530 (Thu, 23 Oct 2008)
          
          Show
          Sreekanth Ramakrishnan added a comment - Also attaching the svn info for the workspace which the build has happened. Path: . URL: http://svn.apache.org/repos/asf/hadoop/core/trunk Repository Root: http://svn.apache.org/repos/asf Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68 Revision: 707297 Node Kind: directory Schedule: normal Last Changed Author: acmurthy Last Changed Rev: 707262 Last Changed Date: 2008-10-23 09:29:20 +0530 (Thu, 23 Oct 2008)
          Hide
          steve_l added a comment -

          what does {{ ant -version}} say? package-info handling is a source of trouble in <java> as it doesnt create an output file, which can screw up dependency logic no-end.

          Note on package-info.java

          package-info.java files were introduced in Java5 to allow package level annotations. On compilation, if the java file does not contain runtime annotations, there will be no .class file for the java file. Up to Ant 1.7.1, when the <javac> task is run again, the task will try to compile the package-info java files again.

          from: http://ant.apache.org/manual/CoreTasks/javac.html

          In Ant 1.7.1 the package-info.java will only be compiled if:

          1. If a package-info.class file exists and is older than the package-info.java file.
          2. If the directory for the package-info.class file does not exist.
          3. If the directory for the package-info.class file exists, and has an older modification time than the the package-info.java file. In this case <javac> will touch the corresponding .class directory on successful compilation.

          Show
          steve_l added a comment - what does {{ ant -version}} say? package-info handling is a source of trouble in <java> as it doesnt create an output file, which can screw up dependency logic no-end. Note on package-info.java package-info.java files were introduced in Java5 to allow package level annotations. On compilation, if the java file does not contain runtime annotations, there will be no .class file for the java file. Up to Ant 1.7.1, when the <javac> task is run again, the task will try to compile the package-info java files again. from: http://ant.apache.org/manual/CoreTasks/javac.html In Ant 1.7.1 the package-info.java will only be compiled if: 1. If a package-info.class file exists and is older than the package-info.java file. 2. If the directory for the package-info.class file does not exist. 3. If the directory for the package-info.class file exists, and has an older modification time than the the package-info.java file. In this case <javac> will touch the corresponding .class directory on successful compilation.
          Hide
          Sreekanth Ramakrishnan added a comment -

          The ant version which I am currently using is 1.7.1, and reason why package-info.java is not compiled because of the reason 3.

          But then how can we ensure that package-info.java being always compiled? Or should we add a note on wiki stating that the ant version of 1.7.1 might cause the version information to be missed out from the generated hadoop binary?

          One way, we can fix this is by touching the generated package-info.java and make it is creation time in future so that the classes directory would always lie in past and the package info gets picked up by the ant.

          Show
          Sreekanth Ramakrishnan added a comment - The ant version which I am currently using is 1.7.1, and reason why package-info.java is not compiled because of the reason 3. But then how can we ensure that package-info.java being always compiled? Or should we add a note on wiki stating that the ant version of 1.7.1 might cause the version information to be missed out from the generated hadoop binary? One way, we can fix this is by touching the generated package-info.java and make it is creation time in future so that the classes directory would always lie in past and the package info gets picked up by the ant.
          Hide
          steve_l added a comment -

          I'd recommend putting enough into package-info.java that the class file gets created by javac. That way, all dependency tools do the right thing, including Ant 1.7.0

          Show
          steve_l added a comment - I'd recommend putting enough into package-info.java that the class file gets created by javac. That way, all dependency tools do the right thing, including Ant 1.7.0
          Ravi Phulari made changes -
          Link This issue is duplicated by HADOOP-5685 [ HADOOP-5685 ]
          Hide
          Ravi Phulari added a comment - - edited

          Not sure if this patch includes test cases for Hadoop version command , in case it does not . Please add test cases for version command in Junit test TestCLI.java with this patch.

          Show
          Ravi Phulari added a comment - - edited Not sure if this patch includes test cases for Hadoop version command , in case it does not . Please add test cases for version command in Junit test TestCLI.java with this patch.
          Hide
          Hong Tang added a comment -

          My workaround was to run ant twice:

          ant $ANT_OPTIONS compile-rcc-compiler
          ant $ANT_OPTIONS tar

          Show
          Hong Tang added a comment - My workaround was to run ant twice: ant $ANT_OPTIONS compile-rcc-compiler ant $ANT_OPTIONS tar
          Eli Collins made changes -
          Labels newbie

            People

            • Assignee:
              Unassigned
              Reporter:
              Sreekanth Ramakrishnan
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Development