Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.6
    • Fix Version/s: 1.5.7, 1.6-beta-2
    • Component/s: Ant integration
    • Labels:
      None
    • Testcase included:
      yes
    • Number of attachments :
      3

      Description

      I have such thing working in our CI environment but couldn't figure out why is it not working when done from command line.

      download http://anonsvn.jboss.org/repos/repository.jboss.org/maven2/jboss/jbossall-client/4.2.2.GA/jbossall-client-4.2.2.GA.jar to jbossall-client.jar

      "groovy -cp jbossall-client.jar groovy_bug.groovy" works fine

      "ant -f groovy_bug.xml" throws an exception although task's classpath is set and otherwise classes from jbossall-client.jar are resolved:
      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

      "ant -lib . -f groovy_bug.xml" works fine.

      1. groovy_ant_fork.patch
        10 kB
        Paul King
      2. groovy_bug.groovy
        2 kB
        A
      3. groovy_bug.xml
        0.5 kB
        A

        Activity

        Hide
        A added a comment -

        Ok, I figured it out. In our CI environment there is -Djava.ext.dirs defined so that's why it is working there. I hope in future groovy versions specifying classpath for the task itself will be sufficient.

        Show
        A added a comment - Ok, I figured it out. In our CI environment there is -Djava.ext.dirs defined so that's why it is working there. I hope in future groovy versions specifying classpath for the task itself will be sufficient.
        Hide
        Paul King added a comment -

        Glad to see your problem is fixed. In any case, this looks like a Java classloader issue not anything to do with Groovy per se.

        Show
        Paul King added a comment - Glad to see your problem is fixed. In any case, this looks like a Java classloader issue not anything to do with Groovy per se.
        Hide
        A added a comment -

        No, the problem is not resolved! What I say with my comment is that I figured out why does it work in our CI environment as initially I was missing the -Djava.ext.dirs configuration option.

        So currently I need to specify "ant -lib <some directory>" to be able to access the external libraries which is not always possible as these are generated during ant's execution.

        A solution to this problem would be to make groovy task's classpath work like specifying -lib to ant.

        Show
        A added a comment - No, the problem is not resolved! What I say with my comment is that I figured out why does it work in our CI environment as initially I was missing the -Djava.ext.dirs configuration option. So currently I need to specify "ant -lib <some directory>" to be able to access the external libraries which is not always possible as these are generated during ant's execution. A solution to this problem would be to make groovy task's classpath work like specifying -lib to ant.
        Hide
        Paul King added a comment -

        Yes, this will require us to support a fork="true" attribute to the groovy task.

        Show
        Paul King added a comment - Yes, this will require us to support a fork="true" attribute to the groovy task.
        Hide
        Paul King added a comment -

        Here is a patch (against trunk) which provides a fork mode for groovy. It still needs more work but might help anyone stuck in a bind because of this issue.

        Show
        Paul King added a comment - Here is a patch (against trunk) which provides a fork mode for groovy. It still needs more work but might help anyone stuck in a bind because of this issue.
        Hide
        Paul King added a comment -

        Resolved by adding a fork mode to the groovy ant task. It supports most of the attributes and subelements available for the java ant task.

        Show
        Paul King added a comment - Resolved by adding a fork mode to the groovy ant task. It supports most of the attributes and subelements available for the java ant task.

          People

          • Assignee:
            Paul King
            Reporter:
            A
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: