Cactus
  1. Cactus
  2. CACTUS-246

Jakarta Cactus 1.7.2 won't work with Apache ANT 1.7.0.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.2
    • Fix Version/s: 1.8
    • Component/s: Ant Integration
    • Labels:
      None
    • Environment:
      - Win XP
      - Apache ANT 1.7.0Beta3
      - JDK 1.5

      Description

      Doing a quick test with Jakarta Cactus 1.7.2 on the latest beta release of Apache ANT 1.7.0 revealed the following
      error message in Cactus:

      java.lang.NoSuchMethodError: org.apache.cactus.integration.ant.CactusTask.addClasspathEntry(Ljava/lang/String;)V

      Reason: in ant-junit.jar the signature of the method 'addClasspathEntry' of the class JUnitTask has been modified between ANT 1.6.5 and ANT 1.7.0:

      ANT 1.6.5:

      protected void addClasspathEntry(String resource)

      ANT 1.7.0:

      protected boolean addClasspathEntry(String resource)

      1. build-246.patch
        1 kB
        Petar Tahchiev
      2. cactuspatch.txt
        0.6 kB
        Ken

        Activity

        Hide
        Petar Tahchiev added a comment -

        Cactus works with Ant 1.7.1 but cannot work with Ant 1.7.0.

        Show
        Petar Tahchiev added a comment - Cactus works with Ant 1.7.1 but cannot work with Ant 1.7.0.
        Hide
        Ken added a comment - - edited

        Attached a patch allowing Cactus to work with Ant nightly-20071115113719 (1.7.1-alpha).

        Show
        Ken added a comment - - edited Attached a patch allowing Cactus to work with Ant nightly-20071115113719 (1.7.1-alpha).
        Hide
        Peter Doornbosch added a comment -

        For those not so familiar with the cactus sources:
        Please note that the patch should be applied to the build.xml file in the integration/ant directory.

        Show
        Peter Doornbosch added a comment - For those not so familiar with the cactus sources: Please note that the patch should be applied to the build.xml file in the integration/ant directory.
        Hide
        Davy Toch added a comment -

        Or even cleaner:

        Change CactusTask such that it holds an instance of Ant 1.7 and an Ant 1.6 task. Modify it such that rather than extending, it delegates depending on the Java environment property $

        {ant.version}

        .

        This way you shouldn't add the attribute "ant_version=1.7" to <cactus>.

        Show
        Davy Toch added a comment - Or even cleaner: Change CactusTask such that it holds an instance of Ant 1.7 and an Ant 1.6 task. Modify it such that rather than extending, it delegates depending on the Java environment property $ {ant.version} . This way you shouldn't add the attribute "ant_version=1.7" to <cactus>.
        Hide
        Jeffrey Bennett added a comment -

        An alternative (and cleaner) proposal:

        Change CactusTask such that it holds an instance of Ant 1.7 and an Ant 1.6 task. Modify it such that rather than extending, it delegates (to 1.6 by default, but an optional argument "ant_version=1.7" can cause it to delegate otherwise).

        Upgrading then consists of changing <cactus> to <cactus ant_version=1.7>

        Show
        Jeffrey Bennett added a comment - An alternative (and cleaner) proposal: Change CactusTask such that it holds an instance of Ant 1.7 and an Ant 1.6 task. Modify it such that rather than extending, it delegates (to 1.6 by default, but an optional argument "ant_version=1.7" can cause it to delegate otherwise). Upgrading then consists of changing <cactus> to <cactus ant_version=1.7>
        Hide
        Jeffrey Bennett added a comment -

        Has there been any progress on this issue?

        I suspect you'll need to support both Ant 1.6 and 1.7 simultaneously. Why not do something like?
        Leave org.apache.cactus.integration.ant.CactusTask alone (link it against Ant 1.6)
        Create org.apache.cactus.integration.ant.Ant17CactusTask (link it against Ant 1.7)
        Create a series of parallel tasks <ant17cactus> <ant17cactifywar> etc.

        When switching to Ant 1.7, consumers would need to change from <cactus> to <ant17cactus> etc.

        OK, I admit, slightly hokey and clumsy, but it gets the job done.

        I've been waiting for a resolution, but would be satisfied with a "We'll address this in version X" statement.

        Show
        Jeffrey Bennett added a comment - Has there been any progress on this issue? I suspect you'll need to support both Ant 1.6 and 1.7 simultaneously. Why not do something like? Leave org.apache.cactus.integration.ant.CactusTask alone (link it against Ant 1.6) Create org.apache.cactus.integration.ant.Ant17CactusTask (link it against Ant 1.7) Create a series of parallel tasks <ant17cactus> <ant17cactifywar> etc. When switching to Ant 1.7, consumers would need to change from <cactus> to <ant17cactus> etc. OK, I admit, slightly hokey and clumsy, but it gets the job done. I've been waiting for a resolution, but would be satisfied with a "We'll address this in version X" statement.
        Hide
        Felipe Leme added a comment -

        Hi all,

        I could reproduce the error following the previous instructions from Davy on Cactus 1.7.2.

        When I tried on the SVN code, it worked fine if I hadn't defined any server. But once I tried to run the tests against Tomcat, I got the same issue, even applying the supplied path.

        I think we have 2 options: upgrade Ant dependency to 1.7.0 or write some wrapping code that calls the right method (that would be an ugly hack).

        Petar, could you check with the Ant guys what would be the 'official' recommendation (if any) for this issue?

        – Felipe

        Show
        Felipe Leme added a comment - Hi all, I could reproduce the error following the previous instructions from Davy on Cactus 1.7.2. When I tried on the SVN code, it worked fine if I hadn't defined any server. But once I tried to run the tests against Tomcat, I got the same issue, even applying the supplied path. I think we have 2 options: upgrade Ant dependency to 1.7.0 or write some wrapping code that calls the right method (that would be an ugly hack). Petar, could you check with the Ant guys what would be the 'official' recommendation (if any) for this issue? – Felipe
        Hide
        Davy Toch added a comment -

        No, I don't think I had a local classpath issue because I
        did the following in DOS:

        1. set CLASSPATH=
        2. set ANT_HOME=
        3. download and unzip fresh copy of Jakarta Cactus 13-1.7.2
        4. download and unzip fresh copy of Apache ANT 1.6.5
        5. download and unzip fresh copy of Apache ANT 1.7.0

        6. go to the subfolder samples/ejb of Jakarta Cactus and type:

        6.1 set ANT_HOME=...home of fresh Apache ANT 1.6.5 ...
        6.2 %ANT_HOME%\bin\ant -version ---> 1.6.5 OK
        6.3 %ANT_HOME%\bin\ant clean test

        ...\samples\ejb\build.xml:134: taskdef A class needed by
        class org.apache.cactus.integration.ant.CactusTask
        cannot be found: junit/framework/Test

        So junit not found.

        6.4 copy junit-3.8.1.jar to %ANT_HOME%\lib
        6.5 %ANT_HOME%\bin\ant clean test ---> OK

        7. go to the subfolder samples/ejb of Jakarta Cactus and type:

        7.1 set ANT_HOME=...home of fresh Apache ANT 1.7.0 ...
        7.2 %ANT_HOME%\bin\ant -version ---> 1.7.0 OK
        7.3 %ANT_HOME%\bin\ant clean test ---> NOK

        BUILD FAILED java.lang.NoSuchMethodError:
        org.apache.cactus.integration.ant.CactusTask.
        addClasspathEntry(Ljava/lang/String;)V

        Remarks :

        • I tried it with JDK 1.4 and JDK 1.5, but both show the
          same behaviour
        • when using ANT 1.6.5, the jar junit 3.8.1 must be copied
          to %ANT_HOME%\lib, because otherwise the following error
          message appears :

        ...\samples\ejb\build.xml:134: taskdef A class needed by
        class org.apache.cactus.integration.ant.CactusTask
        cannot be found: junit/framework/Test

        With ANT 1.7.0, I didn't get this error message, but
        perhaps this is because this error message appears only
        after the following error message:

        BUILD FAILED java.lang.NoSuchMethodError:
        org.apache.cactus.integration.ant.CactusTask.
        addClasspathEntry(Ljava/lang/String;)V

        Show
        Davy Toch added a comment - No, I don't think I had a local classpath issue because I did the following in DOS: 1. set CLASSPATH= 2. set ANT_HOME= 3. download and unzip fresh copy of Jakarta Cactus 13-1.7.2 4. download and unzip fresh copy of Apache ANT 1.6.5 5. download and unzip fresh copy of Apache ANT 1.7.0 6. go to the subfolder samples/ejb of Jakarta Cactus and type: 6.1 set ANT_HOME=...home of fresh Apache ANT 1.6.5 ... 6.2 %ANT_HOME%\bin\ant -version ---> 1.6.5 OK 6.3 %ANT_HOME%\bin\ant clean test ...\samples\ejb\build.xml:134: taskdef A class needed by class org.apache.cactus.integration.ant.CactusTask cannot be found: junit/framework/Test So junit not found. 6.4 copy junit-3.8.1.jar to %ANT_HOME%\lib 6.5 %ANT_HOME%\bin\ant clean test ---> OK 7. go to the subfolder samples/ejb of Jakarta Cactus and type: 7.1 set ANT_HOME=...home of fresh Apache ANT 1.7.0 ... 7.2 %ANT_HOME%\bin\ant -version ---> 1.7.0 OK 7.3 %ANT_HOME%\bin\ant clean test ---> NOK BUILD FAILED java.lang.NoSuchMethodError: org.apache.cactus.integration.ant.CactusTask. addClasspathEntry(Ljava/lang/String;)V Remarks : I tried it with JDK 1.4 and JDK 1.5, but both show the same behaviour when using ANT 1.6.5, the jar junit 3.8.1 must be copied to %ANT_HOME%\lib, because otherwise the following error message appears : ...\samples\ejb\build.xml:134: taskdef A class needed by class org.apache.cactus.integration.ant.CactusTask cannot be found: junit/framework/Test With ANT 1.7.0, I didn't get this error message, but perhaps this is because this error message appears only after the following error message: BUILD FAILED java.lang.NoSuchMethodError: org.apache.cactus.integration.ant.CactusTask. addClasspathEntry(Ljava/lang/String;)V
        Hide
        Petar Tahchiev added a comment -

        Davy this behaviour seems like a classpath issue problem. It turns out that when I have something that had been built other version of ant (different than 1.7.0) and you try to build it with the new version of Ant it complains. The real solution is to just ensure you have cleaned everything with
        ant clean
        and then try building it with ant.
        HTH

        Show
        Petar Tahchiev added a comment - Davy this behaviour seems like a classpath issue problem. It turns out that when I have something that had been built other version of ant (different than 1.7.0) and you try to build it with the new version of Ant it complains. The real solution is to just ensure you have cleaned everything with ant clean and then try building it with ant. HTH
        Hide
        Petar Tahchiev added a comment -

        Davi hi,

        Thank you for pointing this.

        I also noticed this problem with one of the first BETA versions of Apache ANT 1.7, but I decided to wait till the official release of ANT 1.7. Here I am attaching a patch that solves the issue.

        Show
        Petar Tahchiev added a comment - Davi hi, Thank you for pointing this. I also noticed this problem with one of the first BETA versions of Apache ANT 1.7, but I decided to wait till the official release of ANT 1.7. Here I am attaching a patch that solves the issue.

          People

          • Assignee:
            Petar Tahchiev
            Reporter:
            Davy Toch
          • Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development