Discussion:
[tycho-user] tycho gives a wrong compiler error (that eclipse doesn't give anymore)
Johan Compagner
2018-05-29 15:26:27 UTC
Permalink
Hi

Because we are using dbcp2 of apache and we moved to the latest release we
had to also include jta (javax.transaction) into our plugin

That is a very old lib so we adjusted the manifest our self to have stuff
like:

Bundle-SymbolicName: javax.transaction
Bundle-Version: 1.1
Export-Package: javax.transaction;version="1.1.0",javax.transaction.xa
;version="1.1.0";partial=true

then it works fine in eclipse. (it would complain because of restricted api
on javax.transaction.TransactionManager class that we use because we
override a class from a 3th party lib)

But when i use this now with tycho:

[ERROR] Access restriction: The type 'TransactionManager' is not API
(restriction on classpath entry
'C:\Users\jcomp\.m2\repository\p2\osgi\bundle\javax.transaction\1.1.0\javax.transaction-1.1.0.jar')

but that shouldnt be restricted...

If i run maven with -X and look what classpath it generated it something
very weird

C:\Users\jcomp\.m2\repository\p2\osgi\bundle\javax.transaction\1.1.0\javax.transaction-1.1.0.jar[+javax/transaction/xa/*;?**/*]

i think that means it only exports the /xa/ package folder?

If i look a bit more into the classpath i see also this:


[DEBUG]
C:\Users\jcomp\.m2\repository\p2\osgi\bundle\org.eclipse.osgi\3.13.0.v20180409-1500\org.eclipse.osgi-3.13.0.v20180409-1500.jar[+javax/transaction/*;+org/osgi/framework/*;~org/eclipse/core/runtime/adaptor/*;~org/eclipse/core/runtime/internal/adaptor/*;+org/eclipse/equinox/log/*;
AND A LOT MORE;?**/*]

Why does osgi bundle have that as some kind of export?

How can i get tycho to compile just correctly?
Why does it compain at the first place? Is export package really needed?
When do we really have those restricted api in the first place?
--
Johan Compagner
Servoy
Loading...