Hello.

Please CC me on reply, because I am not subscribed to this list. Thank you.

I am trying to create support for building of Eclipse plugins and features using Maven 2 without changing it or patching it significantly. I want to be able to have Eclipse/OSGi bundles stored in Maven repository and with minimal POMs.

Biggest difference between Eclipse plugin and Maven project is that Eclipse plugin may use precompiled libraries, multiple sources and produce multiple libraries. Handling multiple sources is easy, because Maven internally supports multiple source roots. Then I unpack precompiled libraries to target/classes. When everything is compiled I identify which compiled class comes from which library and pack them correctly. Finally I pack everything into one bundle and let Maven ship it to the repository. All this is defined by new packaging "eclipse-plugin".

Up until now everything works. However there is a problem with dependencies - OSGi bundle is not normal JAR with classes, at least not bundles used in Eclipse, but it contains multiple JARs which are mentioned in Bundle-ClassPath in MANIFEST.MF. Such bundle is of no use for compilation - javac is not able to find any classes there (which is not surprising). So what I do is that I repack bundles (unpack all libraries and pack it to one normal JAR) of all dependencies just before compilation begins and register them as dependency artifact files (Artifact.setFile()). This works with the exception that transitive dependencies lose this unbundled file after dependency resolution which unfortunately happens during compilation. I think little picture will be better:

eclipse-plugin A, file plugin.a.jar
eclipse-plugin B, file plugin.b.jar, depends on A
eclipse-plugin C, to be compiled, depends on B

When C is about to be compiled it looks like:

eclipse-plugin A, file plugin.a.unbundled.jar
eclipse-plugin B, file plugin.b.unbundled.jar

But then compiler Mojo is executed which has @requiresDependencyResolution and suddenly it looks like this:

eclipse-plugin A, file plugin.a.jar
eclipse-plugin B, file plugin.b.unbundled.jar

Direct dependency is intact, but transitive dependency is re-resolved. I have no idea why, I looked into the code and it seems to me that already resolved artifacts should be left intact, but obviously they are not. Is this a feature or a bug?

There is a possible workaround: move bundle aside and place unbundled jar in its place. This does not look that bad when I think about it (apart from the need to recompute hashes).

Note that I want to achieve the goal that bundles are stored in repository and that the same content should not be stored in repository twice (= bundled and unbundled can both be stored only in local repository (or in local repository and some cache), but not in remote repository).

Ideally Maven 2 would allow me to "explode" artifact file when it is downloaded and to allow to have more than one classpath element per-artifact.

Thank you for comments.

Have a nice day.

Stepan Roh



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to