Ivy
  1. Ivy
  2. IVY-1016

Patch to add an ivy:eclipse ant task that generates Eclipse .classpath files

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 2.3.0-RC1
    • Fix Version/s: None
    • Component/s: Ant
    • Labels:
      None

      Description

      I put together a post-resolve ivy:eclipse task that updates the Eclipse .classpath file according to the result of ivy:resolve. It also will discover any source jars if they are part of the resolve/download, and automatically attach them to the corresponding entries.

      For example, I have this entry in ivy.xml:

      ivy.xml
      <dependency org="commons-collections" name="commons-collections" rev="3.2.1" conf="compile;references">
          <artifact name="commons-collections" type="sources" ext="jar" m:classifier="sources" conf="references" />
      </dependency>
      

      In build.xml, I have:

      build.xml
      <target name="eclipse" description="Updates eclipse classpath.">
          <ivy:configure settingsId="ivy.eclipse" override="true" />
          <ivy:resolve settingsRef="ivy.eclipse" conf="compile, references" />
          <ivy:eclipse settingsRef="ivy.eclipse" conf="compile, references" />
      </target>
      

      And running 'ant eclipse' will update my .classpath with the cache path to the commons-collections jar, with its sources jar attached. The classpath entry will be annotated with an ivygen="true". Next time I run 'ant eclipse', this entry will be recognized and replaced with whatever updated paths.

      This is only the first draft. I know there is IvyDE, but I feel that this could be a good starting point for an alternative that is more Ant-oriented.

        Activity

        Hide
        Xavier Hanin added a comment -

        And don't forget to talk about it on the user mailing list, and also add a link to it on the wiki.

        Show
        Xavier Hanin added a comment - And don't forget to talk about it on the user mailing list, and also add a link to it on the wiki.
        Hide
        Jing Xue added a comment -

        I guess you have a good point, Xavier. I'll wrap this up in a separate package. Thanks for the comment!

        Show
        Jing Xue added a comment - I guess you have a good point, Xavier. I'll wrap this up in a separate package. Thanks for the comment!
        Hide
        Xavier Hanin added a comment -

        Thanks for this contribution Jing! But does it really need to be integrated in ivy core? Maybe this could be provided as a separate plugin?

        Show
        Xavier Hanin added a comment - Thanks for this contribution Jing! But does it really need to be integrated in ivy core? Maybe this could be provided as a separate plugin?
        Hide
        Jing Xue added a comment -

        The Ant task implementation. Drop it under src/java/org/apache/ivy/ant/, and apply the following patch:

        --- src/java/org/apache/ivy/ant/antlib.xml      (revision 737630)
        +++ src/java/org/apache/ivy/ant/antlib.xml      (working copy)
        @@ -43,4 +43,5 @@
                <taskdef name="findrevision" classname="org.apache.ivy.ant.IvyFindRevision"/>
                <taskdef name="buildnumber" classname="org.apache.ivy.ant.IvyBuildNumber"/>
                <taskdef name="cleancache" classname="org.apache.ivy.ant.IvyCleanCache"/>
        +       <taskdef name="eclipse" classname="org.apache.ivy.ant.EclipseClasspath"/>
         </antlib>
        
        Show
        Jing Xue added a comment - The Ant task implementation. Drop it under src/java/org/apache/ivy/ant/, and apply the following patch: --- src/java/org/apache/ivy/ant/antlib.xml (revision 737630) +++ src/java/org/apache/ivy/ant/antlib.xml (working copy) @@ -43,4 +43,5 @@ <taskdef name= "findrevision" classname= "org.apache.ivy.ant.IvyFindRevision" /> <taskdef name= "buildnumber" classname= "org.apache.ivy.ant.IvyBuildNumber" /> <taskdef name= "cleancache" classname= "org.apache.ivy.ant.IvyCleanCache" /> + <taskdef name= "eclipse" classname= "org.apache.ivy.ant.EclipseClasspath" /> </antlib>

          People

          • Assignee:
            Unassigned
            Reporter:
            Jing Xue
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development