Nov 10th, 2008, 02:42 AM
How to reference Spring in Eclipse-PDE-Projects
I'm new to Spring and the dependency management in Eclipse-PDE-Projects and I get in trouble by integrating Spring into a PDE-Project.
That's my situation: we have a pde-project, where we want to use spring.
So far we used maven to resolve jar-dependencies in our java-projects and we generated the appropriate eclipse-projects and classpath-files by running mvn eclipse:eclipse. To get a real pde-project as well I configured the maven-eclipse-plugin by adding the pde-configuration to our pom.
Because we have to use some spring features in our pde project I also added the following dependency to the pom:
We used that dependency in classic eclipse-java-projects as well, and it works very fine, because it correctly creates the classpath-entries for the eclipse-ide.
Now if I call mvn eclipse:eclipse on the pde-project, the spring-classpath-entries in .classpath and the resourcelinks in .project are missing. I also tried to set the copy-dependencies-execution to the pom, described under maven.apache.org/plugins/maven-eclipse-plugin/pde.html,
but the spring-dependency is missing as well. I only get a dependency to commons-logging-1.1.1.jar, linked into .project, .class and manifest.mf. I suppose, maybe that's it related to the optional-tag I found in spring-2.5.5.pom. (??)
By investigating the web, I found some further suggestions, that refer to some articles around spring dm and some explanations that try to integrate spring by eclipse-spring-plugins; e.g. swissdev.blogspot.com/2008/06/eclipse-rcp-application-using-spring-dm.html. So I downloaded the spring-osgi-1.1.2-with-dependencies.zip, imported the included osgi-jars, setup the plugin-dependencies. Although I solved the compile errors, now I get errors if I "validate the plugin-set" in the run configuration of the eclipse-pde-project. The concrete error is: "Missing constraint: Import Package: org.slf4j;version="[1.5.0,2.0.0)"
Now I'm a little bit confused, how to resolve the spring dependency to the pde project in the correct way.
So my first question is:
What is the right way to resolve the dependency? By maven setting the spring-2.5.5.jar to the .classpath-file or by setting the eclipse-plugin-dependency in manifest.mf?
- If I use the .classpath-way: How do I fully include the spring-2.5.5.jar correctly into the pde project, so that calling mvn eclipse:eclipse includes the complete spring-2.5.5.jar?
- If I use the manifest.mf-way: How do I setup the plugin-dependencies correctly?
Thanks for your help
Tags for this Thread