bndtools / bndtools

ARCHIVED: The contents of this repo have been merged into the `bnd` repo.
https://github.com/bndtools/bnd
Eclipse Public License 1.0
192 stars 90 forks source link

Bnd plugins don't work any more #902

Closed paulbakker closed 9 years ago

paulbakker commented 9 years ago

I have several workspaces with the Felix Dependency Manager Annotations plugin installed. In is configured in build.bnd:

-plugin: \
    ${ext.repositories.-plugin},\
    org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin;path:=cnf/plugins/org.apache.felix.dependencymanager.annotation-3.1.1-SNAPSHOT.jar;build-import-export-service=false

With the latest bndtools build this doesn't work any more. The error log shows the following:

An internal error occurred during: "Building workspace".

java.lang.Error: DM Annotation plugin failure
    at org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin.analyzeJar(AnnotationPlugin.java:130)
    at aQute.bnd.osgi.Analyzer.doPlugins(Analyzer.java:587)
    at aQute.bnd.osgi.Analyzer.analyze(Analyzer.java:170)
    at aQute.bnd.osgi.Builder.analyze(Builder.java:343)
    at aQute.bnd.osgi.Analyzer.calcManifest(Analyzer.java:617)
    at aQute.bnd.osgi.Builder.build(Builder.java:80)
    at aQute.bnd.osgi.Builder.builds(Builder.java:1241)
    at aQute.bnd.build.Project.buildLocal(Project.java:1413)
    at org.bndtools.builder.NewBuilder.rebuild(NewBuilder.java:593)
    at org.bndtools.builder.NewBuilder.rebuildIfLocalChanges(NewBuilder.java:481)
    at org.bndtools.builder.NewBuilder.build(NewBuilder.java:164)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:299)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:302)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:358)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:381)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

It looks like a Gradle build still works, so I'm expecting the problem is in Bndtools, not bnd.

pderop commented 9 years ago

Hi Paul;

In the old org.apache.felix.dependencymanager.annotation-3.1.1-SNAPSHOT.jar, the DM annotations plugin was using a class extending the aQute.lib.osgi.ClassDataCollector, but this class was overriding the "classBegin(int access, String name)", which is probably not available anymore in the latest bndlib (not sure, it's a supposition).

Now, in the latest "org.apache.felix.dependencymanager.annotation-3.2.0" version, I have fixed this class in order to override the "void classBegin(int access, TypeRef name)" method instead of the "void classBegin(int access, String name")" method.

So, can you please redo the test with the latest "org.apache.felix.dependencymanager.annotation-3.2.0" release ?

/Pierre

paulbakker commented 9 years ago

Changing the path to the plugin to a absolute path fixes the problem. Still this is a potentially breaking change, which I can't explain yet.

paulbakker commented 9 years ago

@pderop Same problem with 3.2.0, but when using an absolute path 3.2.0 works well also.

pderop commented 9 years ago

it seems that I also reproduce the problem: I just compiled the latest bndtools, and installed it in Eclipse Juno.

I'm using the following bndtools test:

/tmp/myproject/cnf/... /tmp/myproject/test/...

I then copied the dm annotation plugin in /tmp/myproject/cnf/plugins/org.apache.felix.dependencymanager.annotation-3.2.0/org.apache.felix.dm.annotation-3.2.0.jar

and in /tmp/myproject/test/bnd.bnd bundle, I'm then using:

-plugin: org.apache.felix.dm.annotation.plugin.bnd.AnnotationPluginpath:=cnf/plugins/org.apache.felix.dependencymanager.annotation-3.2.0/org.apache.felix.dm.annotation-3.2.0.jar

then bndtools is getting a ClassNotFoundException and can't load the plugin:

Failed to load plugin org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin;log=debug;path:="cnf/plugins/org.apache.felix.dependencymanager.annotation-3.2.0/org.apache.felix.dependencymanager.annotation-3.2.0.jar", error: org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin not found, parent: org.eclipse.osgi.internal.loader.EquinoxClassLoader@60323f[biz.aQute.bndlib:2.4.0.201408302104(id=424)] urls:[file:/tmp/myproject/test/cnf/plugins/org.apache.felix.dependencymanager.annotation-3.2.0/org.apache.felix.dependencymanager.annotation-3.2.0.jar, file:/tmp/myproject/cnf/plugins/biz.aQute.repository/biz.aQute.repository-2.1.0.jar] exception:java.lang.ClassNotFoundException: org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin bnd.bnd /test Unknown Bndtools Problem Marker

In the above error, you can see that the classpath URL seems invalid (because the cnf dir is located in /tmp/myproject/ directory, and not in /tmp/myproject/test/

->

urls:[file:/tmp/myproject/test/cnf/plugins/org.apache.felix.dependencymanager.annotation-3.2.0/org.apache.felix.dependencymanager.annotation-3.2.0.jar

Prefixing the plugin with "${workspace}" is then fixing the problem:

-plugin: org.apache.felix.dm.annotation.plugin.bnd.AnnotationPluginpath:=${workspace}/cnf/plugins/org.apache.felix.dependencymanager.annotation-3.2.0/org.apache.felix.dm.annotation-3.2.0.jar

pkriens commented 9 years ago

I want to close this one, this should have been an absolute path name from the beginning. We could add this to the release notes though?