0

When a jar file that I am using changes names (usually the version number is what changes), is there a better way to update the name than deleting the old jar and adding the new in the Eclipse Java Build Path Libraries tab? What I am really looking for is a way to manage this whole upgrade process of downloading the jar, putting it in my project lib directory, removing the old one, and updating Eclipse. For instance, right now I am using the .jar, source, and javadoc from

cucumber-core-1.1.5.jar 

and would like to update it along with its source and javadoc files to version 1.2.4. In fact there are four different version numbers used by six jar files associated with Cucumber - times three because of the associated source and javadoc files. And my project is also dependent on two other tools, which have their own set of jars and version numbers. How do I set things up so that I can just go in and reset these version numbers in a simple way in the Java Build Path Libraries tab? Or even better, just dump these new jars in a jar/lib directory and Eclipse should work, right?

If that's impossible, how do you suggest I handle version numbers. Do I have to learn how to handle maven or gradle integration with Eclipse, or have you found a simple way to manage upgrading your tool versions?

1 Answer 1

0

I looked at the Eclipse .classpath at the root directory of my project, and found that the source and javadoc locations are included there with the classpathentry tag. For instance, here is what I have for JUnit:

<classpathentry kind="lib" path="vendor/junit-libs/junit-current.jar" sourcepath="vendor/junit-libs/junit-current-sources.jar">
    <attributes>
        <attribute name="javadoc_location" value="jar:platform:/resource/myproject/vendor/junit-libs/junit-current-javadoc.jar!/" />
    </attributes>
</classpathentry>

Notice that I am using "-current" anywhere that the files I downloaded had a version number. I originally did that because I couldn't get variables to work in a previous version of Eclipse. Now, I'm thinking that I could use this "-current" trick as part of a scheme to only enter version numbers in a single place, a Gradle file or Ant build.properties file.

Gradle has a very convenient way to download libraries and get them installed in the Eclipse build path. See jmruc's example at https://stackoverflow.com/a/17008509/1759555 . But I could find no evidence in the Gradle documentation that Gradle takes care of source and javadoc

My strategy for attacking the problem is going to be

  1. use "-current" in Eclipse where the downloaded files have a version number
  2. download the files and change their names with Ant
  3. use an Ant build.properties file to store the file names and version numbers in a single place for my project

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.