Menu

#110 with "use ant parser", sees no targets at all

open
None
9
2004-07-09
2004-07-07
No

After upgrading to 2.2, when "use Ant's parser" is
checked, AntRunner cannot see any targets in the build
file at all.

Running with "C:\JBuilderX\bin\JBuilder -verbose" shows:

7160 [AWT-EventQueue-0 ] DEBUG
org.antrunner.aa ( ?) opened project:
file:///C%|/Workarea/CSIMain/csi/xtms.jpx
7160 [AWT-EventQueue-0 ] DEBUG
org.antrunner.aa ( ?) Relative DIR:
C:\Workarea\CSIMain\csi\.AntRunner\xtms
7160 [AWT-EventQueue-0 ] DEBUG
org.antrunner.aa ( ?) ant configured for this project
7170 [AWT-EventQueue-0 ] DEBUG
org.antrunner.aa ( ?) active buildfile:
C:\Workarea\CSIMain\csi\utl\build2.xml
7170 [AWT-EventQueue-0 ] DEBUG
org.antrunner.Y ( ?) using ANT's parser
7170 [AWT-EventQueue-0 ] DEBUG
org.antrunner.Y ( ?) using ANT's parser
7210 [AWT-EventQueue-0 ] DEBUG
org.antrunner.av ( ?) Major version: 1
7210 [AWT-EventQueue-0 ] DEBUG
org.antrunner.av ( ?) Major version: 1
7210 [AWT-EventQueue-0 ] DEBUG
org.antrunner.av ( ?) Minor version: 6
7210 [AWT-EventQueue-0 ] DEBUG
org.antrunner.aa ( ?) no need for an update.
Version is newer or equal
7220 [AWT-EventQueue-0 ] DEBUG
ect.node.action.AntTargetGroup ( ?) could not find
target: install

Discussion

  • Shankar Unni

    Shankar Unni - 2004-07-07
    • priority: 5 --> 9
     
  • Shankar Unni

    Shankar Unni - 2004-07-07

    Logged In: YES
    user_id=167432

    Setting priority high - this bug (and 986926) make this
    release useless for me - I have to roll back to 2.1, which
    seems to work OK (though it has another bug with recognizing
    javac error messages when the task is not called "[javac]").

     
  • Dirk Schnelle-Walka

    Logged In: YES
    user_id=192116

    This is strange.

    Which ant version are you using?

    Are you using special ant features, like import, entities?

    /Dirk

     
  • Dirk Schnelle-Walka

    • assigned_to: nobody --> schnelle
     
  • Shankar Unni

    Shankar Unni - 2004-07-09

    Logged In: YES
    user_id=167432

    Whoops. Missed attaching the info here.

    Using Ant 1.6.2Beta1. This happened both with my old-style
    build.xml (no imports, no entities or entity includes), and
    my new build2.xml (uses Ant 1.6.2 features like import,
    macrodefs and presetdefs).

     
  • Nobody/Anonymous

    Logged In: NO

    I downloaded the sources and took a look. I discovered
    something that might help to resolve this issue
    (The following refers to ANT 1.6.2/ AntRunner 2.2).

    To me it seems like the problem was located in the "parse"
    method of class "AntBuildfileParser" in package
    "org.antrunner.buildfilemanager.ant".

    When invoked via AntRunner, the ANT parser doesn't seem to
    recognize the available tasks (e. g. "property", "echo" etc.)
    properly and therefore might fail in determinating the ANT
    project structure from a given build file.

    When Ant is invoked directly, some method "init()" is invoked
    upon a newly created "Project" object before entering
    the parsing process for the build file. This does not happen
    when ANT is invoked by AntRunner 2.2.

    ---
    After adding a line to the method "parse" as quoted
    below, I had (at least) no more trouble getting ANT to
    accept my build files using my own AntRunner tester
    (so far I have not yet managed to get JBuilder 8 accept my
    patched "antrunner.jar" as a valid IDE extension)

    ---8<--- quote from
    org.antrunner.buildfilemanager.ant.AntBuildfileParser ---8<---

    /**
    * Parse the given file.
    *
    * @param fileName The file to parse
    *
    * @exception Exception Error parsing the file.
    */
    public void parse(final String fileName) throws Exception {
    ProjectHelper helper = ProjectHelper.getProjectHelper();

    File file = new File(fileName);
    project = new Project();
    project.init(); // <- added line
    helper.parse(project, file);
    }

    Best wishes
    RBR

     
  • Dirk Schnelle-Walka

    Logged In: YES
    user_id=192116

    Thanks for the patch.

    It is true that you sshould call project.init() before
    parsing. This method loads the default targets and the
    default properties.

    I added this to the CVS.

    /dirk

     
  • Ruben-B. Reincke

    Logged In: YES
    user_id=1115765

    I suspect there is another line that needs to be added
    to the parse(..) method in
    org.antrunner.buildfilemanager.ant.AntBuildfileParser,
    namely the call

    >> "project.addReference("ant.projectHelper", helper);" <<

    right after project.init();

    I found that Ant 1.6.2 still had trouble in parsing build files
    involving the "import" task when invoked via "patched"
    AntRunner 2.2, the symptom being a Message Box in
    JBuilder 8 reporting a NullPointerException.
    --
    Ant's method "ImportTask.execute()"
    (package "org.apache.tools.ant.taskdefs")
    attempts to obtain a reference to a "ProjectHelper" object
    from a given 'Project' object via
    'getProject().getReference("ant.projectHelper")'.

    This reference will be 'null' unless the Project has been
    assigned a binding for that key before.

    When invoking Ant 1.6.2 directly, a valid reference
    is obviously available because

    org.apache.tools.ProjectHelper.configureProject(Project p, File
    f)

    has been called before.

    The AntRunner way of calling Ant, however, presently does
    not seem to involve this step.

    Best wishes
    RBR

    ----------- 8< -- Quote -- 8< -----------
    /**
    * Parse the given file.
    *
    * @param fileName The file to parse
    *
    * @exception Exception Error parsing the file.
    */
    public void parse(final String fileName) throws Exception {
    ProjectHelper helper = ProjectHelper.getProjectHelper();
    File file = new File(fileName);
    project = new Project();
    project.init(); // <- added line
    project.addReference("ant.projectHelper", helper); // for
    ImportTask.execute()
    helper.parse(project, file);
    }

     
  • Dirk Schnelle-Walka

    Logged In: YES
    user_id=192116

    Thanks for this. Looks convincing. I added this to the CVS.
    /dirk

     
MongoDB Logo MongoDB