This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Embeded libraries with AP Tooling & Maven

Jul 15th, 2008, 04:46 PM

I'm using Q4E to integrate Eclipse and Maven. Q4E creates a Maven Classpath Container that has all the dependencies for my project. The maven-bundle-plugin uses the maven dependencies and the configuration provided to create the MANIFEST.MF for the bundle. AP Tooling uses this generated MANIFEST.MF file to create a bundle at development time and sync to a staging directory for AP. The issue I'm having however is that AP Tooling does not sync the libraries i need in the Bundle-Classpath. If i could get the Maven Classpath Container to sync to the stage directory it would work. Before, when i had my project as a WAR project, Q4E would configure the Maven Classpath Container to be in the J2EE Module Dependencies list and this would cause those libraries to be synced to the stage directory. I'm now no longer using a WAR file, but rather web/service/library bundles and i need this behavior back. Does anyone have a workaround for this? What will AP Tooling use to determine what libraries should be synced to the stage directory? Does anyone know how i can add the J2EE nature to a standard java project (that already has Spring, OSGi, and Maven natures)? This is causing me a lot of trouble and looking like it could be a real blocker so any help would be great!

Comment

I'm not sure I understand what you are asking about. I use Q4E a lot, but I must admit I haven't played around much with different web application packaging options (I went straight from WAR to Web Module).

If you are using shared libraries or shared services, aren't the dependencies already installed in the platform? If I'm not missing something then all you are asking for is the same as everyone else wants - i.e. a way to dynamically download and provision transitive dependencies into the platform. The best we have to offer at the moment for that is configuring the platform to use your local Maven repository for its bundle (not ideal because my Maven repo has 1000s of non-OSGi jars in it).

The way you mention the stage directory, however, makes me think I'm missing something.

Comment

1) I'm building web modules, and other basic bundles so no wars (did the same as you)
2) I already have AP configured to point to my Maven repository

So with that in mind, I have a bundle that has a library i want to embed in the bundle. The library is obscure, not used by anything else, and something that i've built to be embeded into my bundle. Via maven/bundle-plugin/q4e i have that library showing up on my Bundle-Classpath just fine. However, in Eclipse the library only shows up under the Maven Classpath Container and the AP Plugin has no idea that it needs to be deployed to the stage directory when it tries to sync my bundle. So when my bundle gets synced it doesn't have the library, and then i get ClassNotFound exceptions for the classes that are in the library that my code uses.

I referenced a WAR because when i was deploying WAR files to AP Q4E helped me put my dependent bundles on the J2EE Module Dependencies list and the AP Plugin was able to sync these just fine and my war was able to deploy.

Hope that makes sense!

Comment

If you're embedding a jar in your bundle, which is what I think you're doing, the current tooling requires you to place the jar in an Eclipse source folder to get deployed properly to the server. Putting in the root of your project won't work.

Hope that helps,

Joris

Comment

I'm not putting it into the root of my project. It is in my Maven Classpath Container because this is a Maven project imported into Eclipse via Q4E. I don't have direct access to the jars, but there is a container that does, so i'm trying to figure out how to get that container wired in with the sync process. This works if i'm dealing with a J2EE project (same project, but a WAR, deployed to AP), but as a basic Web bundle i'm having no success in figuring out how to make the connection.