Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jdt-core-dev] intercepting .classpath load and save

Hi All,

In my shop, we use Maven for the build system. It is easy to get the
.classpath file and the project.xml file out-of-sync, so I'm looking for a
way to override the classpath entries in the .classpath file with the
dependency entries in the project.xml file. I have used the MavenIDE plug-in
from CodeHaus, which has a POM Synchronize view. However, this solution
requires that the developer actually remember to synchronize when adding a
new library to the classpath. Since there are over one-hundred people
working on these projects, if each person forgets once a year then the build
is broken every other working-day.

What I would like to do is write a plug-in that either decorates or extends
JavaProject. In this new class, I can intercept the readClasspathFile and
saveClasspath methods to keep the files in sync. Unfortunately,
JavaModelManager is a singleton so there is no way to override which
implementation classes are instantiated.

Another solution would be to write a plug-in that modifies the classpath on
startup and then listens for classpath changed events to keep the
project.xml file up-to-date. I am once again foiled since I cannot see any
listener mechanism in the code.

Any thoughts or suggestions on how I can accomplish this?

Faron.



Back to the top