eclipse 插件开发导出jar包到plugin 插件不显示

时间:2021-07-25 20:12:53


故事情节:

插件项目选择 run as eclipse application是正常的,也可以看到插件,也是可以用的,但是导出成jar包放到eclipse下面的plugin里面就是看不到插件
导出方法如下:

eclipse 插件开发导出jar包到plugin 插件不显示


刚开始是以为导出的方式有问题,然后我又怀疑我的构建路径是否有问题,检查后发现一切正常,我又开始猜测是不是我创建eclipse plugin项目时候选择的eclipse版本和本eclipse版本不一致,调整后发现问题还是在,我又开始怀疑是不是我的jdk版本有问题,我又重新创建了一个eclipse plugin项目,应为我的eclipse用的jdk1.6,所以我选择了jre1.6,但是还是不行

经过这两个晚上的网上搜索得到了重要的解决这类问题的办法,在此我不得不承认http://*.com/是个好网站,在里面我获得了重要的信息,我访问了eclipse官网的Where Is My Bundle栏目。

在里面列举出了eclipse插件的各种状态和osgi控制台的常用的命令

INSTALLED - This means that OSGi knows about your bundle but there is something wrong and it couldn't resolve. Problems may include thing from missing dependencies to requiring a higher Java VM version than you are running with. To get more information on why your bundle is not resolved try running the diag <bundle id> command, where <bundle id> is your bundle id or bundle symbolic name.
RESOLVED - If your bundle is resolved but you expected it to be started, then try starting your bundle from the command-line with the start 123 command. If it won't start, then you should get some feedback as to what the problem is.
<<lazy>> - This means your bundle is resolved and is marked to be lazy started. Everything should be ok.
ACTIVE - your bundle is resolved and has been started, everything should be working as planned.
果断在osgi的控制台下输入命令ss

结果:

1056	<<LAZY>>    com.taobao.eclipse.plugin.autodao.ibatis_1.3.0.201206051529
1057 <<LAZY>> com.taobao.eclipse.plugin.autodao.ui_1.3.0.201206051529
1058 <<LAZY>> se.oixx.fastfox_1.5.0
1059 <<LAZY>> org.slave4j_1.0.0
1060 <<LAZY>> com.github.eclipsecolortheme_0.12.0.201207240713
1062 ACTIVE de.anbos.eclipse.logviewer.plugin_0.9.8.8
1063 <<LAZY>> net.sourceforge.jeteditor_0.0.3
1064 ACTIVE net.sourceforge.pmd.eclipse.plugin_4.0.2.v20131031-1124
1065 <<LAZY>> net.java.amateras.umleditor_1.3.4
1066 <<LAZY>> net.java.amateras.umleditor.java_1.3.4
1067 RESOLVED net.java.amateras.xstream_1.3.4
1072 INSTALLED TestCase_1.0.0
1075 INSTALLED Fish4j_1.0.0

敲入命令 bundle 1075

osgi> bundle 1075
Fish4j_1.0.0 [1075]
Id=1075, Status=INSTALLED Data Root=E:\products\CS\eclipse-jee-helios-win32-x86_64\eclipse\configuration\org.eclipse.osgi\bundles\1075\data
No registered services.
No services in use.
No exported packages
No imported packages
No fragment bundles
No named class spaces
No required bundles

敲入命令 diag 1075

osgi> diag 1075
reference:file:plugins/Fish4j_1.0.0.jar [1075]
Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-1.7

这样才有了解决方案,不会像之前那样去毫无目标和证据的猜测,果断把eclipse运行环境调成jdk1.7问题就搞定了,可以睡觉了