facebook

Is there Eclipse-Ant project integration?

  1. MyEclipse Archived
  2.  > 
  3. General
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #266730 Reply

    miamidot
    Member

    I wish to have Eclipse variables exported as Ant properties into a file which I specify (such as ant.build.properties). Which my build.xml could then pick up.

    Currently there is a confusion between the terms automated dev env (ade) as opposed to integrated dev env (ide). Eclipse seems more like an ade rather than an ide. Eclipse provides means to identify libraries and resources. Eclipse provides means to run ant build. But Eclipse does not provide Eclipse resource definition to be integrated with Ant properties.

    A disconnect between development phase and building phase exists in Eclipse. Which means developers have double work – define Eclipse resources and build path and repeat them in the build script. Ability to key in properties at build editor is not “integration”. My Eclipse project properties and my build script is disconnected.

    There are products like ant2eclipse as well as ant4eclipse. However, I do not think those products are adequate. Export is simply not good enough. Because I am hoping, once I have defined a set of properties and exported it, my colleagues sharing the project I have started could use my build.properties file and populate Eclipse buildpath and resource definition – a capability I am hoping MyEclipse could provide over Eclipse. A’la netbeans.

    Then, I could even CVS the build.properties and build.xml files such that anyone could check the project out and be able to develop and build on the project straight away. Does MyEclipse provide such level of integration? If yes, how? Otherwise, when?

    #266852 Reply

    Riyad Kalla
    Member

    No, no Eclipse-based IDE provides this level of integration with Ant that I’m aware of. The reason for this is that the Eclipse project structure may not directly map to any and all Ant files, making the translation very difficult.

    Then you look at the only IDE I’m aware of that actually uses the Ant script as the project file (NetBeans) and the intergration is fine, but you end up with monsterous Ant scripts.

    MyEclipse does not have plans, at the moment, to develop such a solution.

    #266919 Reply

    miamidot
    Member

    I agree with you. In using ant, I have to kluge around like bending my arm behind my head just to scratch my nose. In my extremely haughty opinion (imeho!), it’s time for something better than ant. Ant was concocted to replicate make rather than placate the needs of an IDE.

    I am able to export a build.xml from my Eclipse project through
    [file->export] menu,
    which I could integrate with my ant scripts. However, my colleagues would prefer not having to perform an export everytime they modify the project build path in project properties.

    There is also a .classpath file which is spontaneously updated by Eclipse when buildpath is modified in project properties. As my colleagues (and I) do not like the ant file generated by exporting the project, I wrote an xslt transform to transform the .classpath file:

    <classpath>
        <classpathentry kind="src" path="source"/>
        <classpathentry kind="var" path="lib.ext/jdom.jar"/>
        <classpathentry kind="var" path="lib.ext/jsp-api.jar"/>
        <classpathentry kind="var" path="lib.ext/log4j-1.2.12.jar"/>
        <classpathentry kind="var" path="lib.misc/xercesImpl.jar"/>
        <classpathentry kind="var" path="lib.ext/servlet-api.jar"/>
        <classpathentry kind="output" path="classes"/>
     </classpath>
    

    Which whould generate this resultant ant script

    <project name="Eclipse2AntClasspath" default="mkClasspath" >
     <target name="mkClasspath">
      <path id="prj.class.path">
        <pathelement location="source"/>
        <pathelement location="${lib.ext}/jdom.jar"/>
        <pathelement location="${lib.ext}/jsp-api.jar"/>
        <pathelement location="${lib.ext}/log4j-1.2.12.jar"/>
        <pathelement location="${lib.misc}/xercesImpl.jar"/>
        <pathelement location="${lib.ext}/servlet-api.jar"/>    
      </path>
     </target>
    </project>
    

    Since ant reads all properties and imports in one fell swoop, the target “mkClasspath” has to be triggered in a preceding ant run before the actual build run. This is because the resultant classpath.xml will only be read in the subsequent ant run. I cannot have mkClassPath as part of the dependency of the actual build target.

    I am hoping for someone to tell me if there is a way for me to write an intercepting plugin so that when any colleague of mine changes the buildpath property of a project, Eclipse would spontaneously generate a file of my own design besides generating the usual .classpath file. What are the Eclipse classes that I need to intercept? Perhaps, MyEclipse could provide such a feature.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Is there Eclipse-Ant project integration?

You must be logged in to post in the forum log in