This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I'm creating a new minimal project to use eclispe, ant, hibernate and xdoclet and junit and dbunit. I had an existing AppFuse project that was working so I copied the lib directory to my new project.
Now I wanted to add apache commons-lang v2.1 to the project. I tried making a new directory (commons-lang-2.1) in the lib directory and putting the jar file there. But when I went to project->properties->libraries->add Jar... the newly created directory would not show up! So I tried "Add class folder" it says "Exclusion filters have been added to nesting source folders". What does that mean? I don't know what "Add class folder" did but it did not help because I still cannot use "Add Jar" to add commons-lang v.2.1.
I ended up adding it as an external jar.
Incidently, how does one use the maven like feature where eclispse will automatically update the library?
I'm not sure whether any of this will help, but here are my thoughts...
First, a quick word on source directories: Source directories are those that Eclipse adds to the classpath in a project. Any Java files you want to edit must be in a source directory (or a subdirectory, i.e., if 'src' is a source directory, class com.foo.BarClass would be in directory src/com/foo). One property of source directories is that they cannot be nested. I.e., if 'src' is a source directory, then you can't set 'src/foo' to also be a source directory. This is intuitive - if they were nested, how could Eclipse tell whether a class Bar in directory 'foo' is supposed to be in package foo, or in the default package in source directory 'foo'? (I hope that wasn't too confusing :-\)
In this case, the way to add a JAR is as you did in the first attempt: just dump the JAR anywhere in your project, and add it using project->properties->java build path->libraries->add jar. (this is the location in Eclipse 3.1, I think it moved between 3.1 and 3.0).
If you can't find the JAR, chances are you need to refresh your workspace. Also, I just ran a quick test - JARs won't show up if you put then in a directory that you've set to be a source directory. Perhaps this is what you hit. If 'lib' contains only JARs (not .java files), then it shouldn't be a source directory.
I'm not familiar with Maven, so I can't help on the last point - but if you describe the functionality, perhaps I or someone else can.
Tim, When using Maven, you have a list of jars that your project uses. You can specify that you want the latest one. Maven automatically checks it's remote repository each time you run the build to see if a later version is out there. If so, it downloads it for you. Maven also downloads the file if it is missing (the first time you run the build.)
Siegfried, I don't know of any functionality like that in Eclipse. You can connect to get the latest version of Eclipse plugins. But I don't know of anything that does so for libraries. Which isn't to say it doesn't exist of course.