Hi Stuart -
The references to how to understand uses= were really interesting - I
had not seen those before. Thanks!
I did some more "learning" experiments, based on reading these. I'm
guessing my issues come from mixing Eclipse levels. My current Eclipse
environment is 3.3. The plugin I'm maintaining is set up to build on
3.2. When maven builds it, it loads the Eclipse 3.2 jars because that's
the version that the dependencies specify. But when Eclipse builds it,
it uses the 3.3 jars from the current Eclipse installation I'm running.
In my first experiment, I changed all my dependencies to Eclipse 3.3
level. That made everything work find in both Maven and Eclipse builds.
Next, I went back to the 3.2 level, and tried building on Eclipse 3.2,
and found things broken as before.
I've made a super simple test example which shows the failure. Working
in Eclipse 3.2, I made a new Eclipse plugin, having one "main" class
which does one statement: it prints to sysout the value of SWT.ABORT.
To get access to SWT, it imports org.eclipse.swt.SWT. The POM for this
has one dependency declared
<dependency>
<groupId>org.eclipse.swt.win32.win32</groupId>
<artifactId>x86</artifactId>
<version>3.2.1-v3235</version>
<scope>provided</scope>
</dependency>
which is coming from
http://repo1.maven.org/maven2/org/eclipse/swt/win32/win32/x86/3.2.1-v3235/x86-3.2.1-v3235.pom
This compiles fine in Maven, but the manifest generated is missing the
import-package for org.eclipse.swt
Manifest-Version: 1.0
Export-Package: t
Built-By: schor
Build-Jdk: 1.6.0_02
Bundle-Version: 0.0.1
Tool: Bnd-0.0.227
Bundle-Name: Test and Learning Plugin
Bnd-LastModified: 1202751928745
Created-By: Apache Maven Bundle Plugin
Bundle-ManifestVersion: 2
Bundle-SymbolicName: testing.do.not.use.t
Import-Package: t
If I add the BND instruction
<Import-Package>*,org.eclipse.swt</Import-Package>
the [bundle] step gives this message:
[WARNING] Warning building bundle testing.do.not.use:t:bundle:0.0.1 :
Importing packages that are never refered to by any class on the
Bundle-Classpath[Jar:dot]
: [org.eclipse.swt]
But now the Eclipse build works.
(zip of the whole project sent to Stuart)
Thanks for helping get to the bottom of this.
-Marshall
Stuart McCulloch wrote:
On 11/02/2008, Marshall Schor <[EMAIL PROTECTED]> wrote:
OK - I did this just now. First I shut down Eclipse so there's no
possibility of overwriting from there... I looked at the generated
manifest.
The code in the first package listed under Export-Package contains
references to org.eclipse.swt.SWT, but if you look at the uses= clause,
you'll see that the package org.eclipse.swt is not there, as an
example. (Straight cut/paste from the manifest.mf follows, sorry for
the poor formating)
FYI, the 'uses' clause is only there to protect against potential class cast
exceptions (it tries to guarantee a consistent class space) as described:
http://underlap.blogspot.com/2007/10/osgi-type-safety-and-uses-directive.html
however, some people have had problems with Equinox and large sets
of 'uses' because of the way it processes them - the forthcoming 1.2.1
release of the bundleplugin supports removal and editing of 'uses':
https://issues.apache.org/jira/browse/FELIX-459
so you might find removing the 'uses' improves performance in Eclipse,
but this won't help with those missing imports - though you can always
add them to the generated Import-Package by using something like:
<Import-Package>org.foo,com.bar,*</Import-Package>
You can even remove bogus detected imports by using negation:
<Import-Package>!org.xyz.internal,org.foo,com.bar,*</Import-Package>
HTH
Export-Package: org.apache.uima.taeconfigurator.editors.ui.dialogs;use
s:="org.eclipse.core.runtime,org.eclipse.swt.custom,org.apache.uima.a
nalysis_engine,org.eclipse.jface.fieldassist,org.eclipse.ui.forms.wid
gets,org.apache.uima,org.apache.uima.taeconfigurator,org.eclipse.core
.resources,org.apache.uima.resource.metadata,org.eclipse.swt.events,o
rg.apache.uima.cas,org.apache.uima.taeconfigurator.model,org.eclipse.
swt.layout,org.apache.uima.resource,org.apache.uima.taeconfigurator.e
ditors.ui,org.apache.uima.taeconfigurator.editors,org.eclipse.swt.gra
phics,org.eclipse.swt.widgets,org.eclipse.ui.fieldassist,org.eclipse.
jface.dialogs", ...
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]