我想包装一个第三方罐子。不幸的是,供应商将一个具有一种方法的单一类(a.class)放入默认包中。
当我尝试使用 包含资源Include-Resource: @lib/acme-8.0.jar
时,会导致以下错误:
The default package '.' is not permitted by the Import-Package syntax.
This can be caused by compile errors in Eclipse because Eclipse creates valid class files regardless of compile errors.
The following package(s) import from the default package [com.acme.util]
bnd print -all acme-8.0.jar
给我以下输出(缩短,供应商名称替换为 acme)
[API USES]
. []
com.acme.common []
com.acme.acmedrt [com.acme.acmedrt.types, com.acme.acmedrt.comm.jobtransport, com.acme.acmedrt.workflow.type
s]
com.acme.acmedrt.impl [com.acme.acmedrt, com.acme.acmedrt.types, org.apache.commons.logging, com.acme.acmedrt.imp
l.types, com.acme.acmedrt.comm.jobtransport, com.acme.acmedrt.pool, org.apache.commons.pool, com.acme.acmedrt.workflow.types]
com.acme.acmedrt.impl.types [com.acme.acmedrt.types, com.acme.acmedrt, com.acme.acmedrt.impl, org.xml.sax]
com.acme.acmedrt.notification [com.acme.acmedrt]
com.acme.acmedrt.pool [com.acme.acmedrt, com.acme.acmedrt.impl.types, com.acme.acmedrt.impl, com.acme.acmedrt.types,
org.apache.commons.pool, com.acme.acmedrt.workflow.types]
com.acme.acmedrt.types [com.acme.acmedrt, com.acme.common]
com.acme.acmedrt.util []
com.acme.acmedrt.workflow.types [com.acme.common]
com.acme.tools []
com.acme.util []
com.acme.util.xml []
[LIST]
a.class
META-INF
MANIFEST.MF
com
com <no contents>
com/acme
com/acme <no contents>
com/acme/common
Enum.class
com/acme/acmedrt
[...]
如果我正确理解此输出,则有几个包使用默认包。这怎么可能呢?据我所知,您不能从默认包中导入类。
我已经联系了供应商,要求移动有问题的班级。很有可能,他不会听从我的建议。
是否有解决方法来处理默认包中的类?