** WARNING: _Not_ for the feint of heart. **
I work on a large and complex software project. Our directory
structure is part inherited, part legacy, and can best be described as
a horible broken mess. We have an ant script that brings in various
libraries, utilities, and directories to compile our source into
various output directories. Our source is managed by CVS. Our build
is managed by Ant. I am torn between the two.
If I use source that's already checked out and create a project using
Ecliplse 3.1 "Java Project from Existing Ant Buildfile", it performs a
great deal of magic, imports the proper libraries, sets up the
necessary source files, and with a few tweaks, gets to a point where it
can build the source and put it in the proper location. I still have
to use the ant script to package the class files into their respective
JAR files, but I'm ok with that. The problem in this scenario is that
if I try to connect the project to our CVS repository using "Team ->
Share Project...", it gets all confused, and after much processing, is
convinced that ever existing file needs to be added to the repository
and every repository file needs to be downloaded. Not good.
If I check out the java project from the repository using Eclipse
"Checkout projects from CVS", I can't figure out how to get Eclipse to
read the Ant script and do all its magic setting up the libraries and
paths correctly after the project has been checked out. Immediatly,
Eclipse begins complaining about compile errors and unresolved
references throughout the source tree. Not good.
I need to find a way to correctly connect a project created from an ant
build script with the CVS repository, or get Eclipse to read a build
script and set up all the paths and libraries _after_ the project has
been checked out of CVS.
Any help would be greatly appreciated.
sjc
sjc@qx.net - 29 May 2005 02:14 GMT
I've learned alot about eclipse while trying to solve my own problem,
and I have to my satisfaction. I hope anyone that finds themselves in
the above situation finds my tinkering helpful.
I started with just using the CVS Repositories view to check the source
out into a new project. To activate all the Java specific project
options, I closed the project and modified the .project file to read:
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
I found the above stanza examining the .project file of a Java project.
Upon opening the project, Eclipse complains about not finding any
classpaths. It turns out the only "magic" performed by creating the
project from an ant build script is accurately finding and adding all
the necessary classpaths. I simply copied the .classpath file
generated from another workspace directory that contained the project
created from the ant script.
To get the default java builder into the CVS project, I added the
following stanza to the .project file:
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
Again finding the above stanza in a Java project .project file.
Some of the above steps could have been avoided if I had chosen to
create the CVS project using the wizard because I think you get the
chance to specify a Java project wizard after the CVS project creation
wizard exits.
Anyway, the gist of it is that if a project doesn't behave exactly the
way you want it to and there aren't any user interface menus or tool
bars to do what you want, Eclipse is very easy to reconfigure be
editing its configuration files directly, at your own risk, of course.
Hope someone finds this helpful.
sjc
Dale King - 01 Jun 2005 04:35 GMT
> I've learned alot about eclipse while trying to solve my own problem,
> and I have to my satisfaction. I hope anyone that finds themselves in
[quoted text clipped - 36 lines]
> bars to do what you want, Eclipse is very easy to reconfigure be
> editing its configuration files directly, at your own risk, of course.
The modifications you made to the .project file could have been avoided
by selecting "Check out as..." instead of "Check out as project". You
would then have been able to select that you wanted to check it out as a
Java project and it would have created the .project file for a Java
project. Once you check in the .project file into the CVS project then
it will know next time that it is a Java project.
You do have to set up your classpaths for the project, but there is a
GUI for doing that.
So there was no need to manually edit any configuration files. If you
feel the need to manually edit one you are probably doing something
wrong (although there are some times it can be necessary).

Signature
Dale King