The default package '.' is not permitted by the Import-Package syntax

拈花ヽ惹草 提交于 2019-12-05 12:30:37

You probably didn't place your class inside a package.

Add

package your_package_name;

at the top of your .java file and you should be good.

PS: Depending on your package name, you may need to move the file to some other location as well

From what I understand about the OSGi library .class files are where they shouldn't be b/c the way this library is structured there are deps in the root package.

Looking at this blog yields more detail.

I did fix after remove "classes", "obr" and "\container\tomcat8x\cargo-confluence-home" folder inside "target" then only run atlas-package

Add an conditional breakpoint (binaryName.equals(".");) inside the class constructor of aQute.bnd.osgi.Descriptors.PackageRef and check which dependency is making trouble.

This error message can also appear due to https://github.com/bndtools/bnd/issues/1848, where the bnd.bnd file has a directive such as e.g. this:

Bundle-Activator: ${classes;IMPLEMENTS;org.osgi.framework.BundleActivator}

and when there is no class that implements BundleActivator, then, confusingly, BND prints that error.

In my case, it was the JDOM plugin. Resolution from the blog [1] linked in the currently accepted answer sounds reasonable. Remove the top-level class from JDOM through some arcane pom.xml Maven magic.

It turned out I was pulling JDOM by mistake, because I wrongly declared dependency on the maven-bundle-plugin. I put it into my <dependencies>, instead of into <build><pluginManagement>. The plugin depends on JDOM, and I was bundling transitive dependencies. Fixing my dependency declaration cleared the problem.

[1] https://techotom.wordpress.com/2014/10/21/fixing-the-default-package-is-not-permitted-by-the-import-package-syntax-with-maven-bundle-plugin/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!