大家好,自己做了一个插件。调试和开发磕磕绊绊的算是完成了。但是在插件打包发布的阶段遇到问题。在打包的过程中报错,看LOG显示如下。我觉得主要是在开发阶段使用了一些开源的包,感觉打包的时候找不到这些包! 
# 5 十一月 2005 16:52:45 
---------- 
1. ERROR in G:\workspace\TestPlug-in\src\com\zhjy\framework\exception\BasicException.java 
(at line 8) 
import org.apache.commons.lang.builder.ToStringBuilder; 
^^^^^^^^^^ 
The import org.apache cannot be resolved 
---------- 
2. ERROR in G:\workspace\TestPlug-in\src\com\zhjy\framework\exception\BasicException.java 
(at line 9) 
import org.apache.log4j.Logger; 
^^^^^^^^^^ 
The import org.apache cannot be resolved 
---------- 
3. WARNING in G:\workspace\TestPlug-in\src\com\zhjy\framework\exception\BasicException.java 
(at line 28) 
public class BasicException extends RuntimeException 
^^^^^^^^^^^^^^ 
The serializable class BasicException does not declare a static final serialVersionUID field of type long 
---------- 
4. ERROR in G:\workspace\TestPlug-in\src\com\zhjy\framework\exception\BasicException.java 
(at line 34) 
private static final Logger logger = Logger.getLogger(BasicException.class); 
^^^^^^ 
Logger cannot be resolved to a type 
---------- 
5. ERROR in G:\workspace\TestPlug-in\src\com\zhjy\framework\exception\BasicException.java 
(at line 34) 
private static final Logger logger = Logger.getLogger(BasicException.class); 
^^^^^^
打包过程:选择项目名称->Export->Deployable plug_ins and fragments->出现的页面:选择了Directory,其他的使用的是默认值。
版本是:Eclipse 3.1

解决方案 »

  1.   

    少了几个commons的包,把这些包也打进去。
      

  2.   

    昨天,晚上编译的问题搞定了!但是把插件放到eclipse的plugins目录下的时候,运行时报错:在打开相应的透视图的时候
    com.zhjy.helper.view.CreateFileView是我的一个透视图!请问是为啥?谢谢!!
    我打包的插件目录结构为:
    +zhyPlug_in_1.0.0
     +bin           是class
     +icons         是图标
     +lib           是需要的包   
     +META-INF      里面是MANIFEST.MF
     +src           是源文件
     +plugin.xml
    java.lang.ClassNotFoundException: com.zhjy.helper.view.CreateFileView
    at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:403)
    at org.eclipse.osgi.framework.internal.core.BundleLoader.findClass(BundleLoader.java:350)
    at org.eclipse.osgi.framework.adaptor.core.AbstractClassLoader.loadClass(AbstractClassLoader.java:78)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.osgi.framework.internal.core.BundleLoader.loadClass(BundleLoader.java:275)
    at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:227)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1259)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:152)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:142)
    at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:129)
    at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:48)
    at org.eclipse.ui.internal.WorkbenchPlugin$1.run(WorkbenchPlugin.java:240)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
    at org.eclipse.ui.internal.WorkbenchPlugin.createExtension(WorkbenchPlugin.java:236)
    at org.eclipse.ui.internal.registry.ViewDescriptor.createView(ViewDescriptor.java:99)
    at org.eclipse.ui.internal.ViewReference.createPartHelper(ViewReference.java:267)
    at org.eclipse.ui.internal.ViewReference.createPart(ViewReference.java:180)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:552)
    at org.eclipse.ui.internal.ViewReference.getView(ViewReference.java:152)
    at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:923)
    at org.eclipse.ui.internal.WorkbenchPage.access$12(WorkbenchPage.java:913)
    at org.eclipse.ui.internal.WorkbenchPage$13.run(WorkbenchPage.java:3148)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
    at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3145)
    at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:3123)
    at org.eclipse.ui.handlers.ShowViewHandler.openView(ShowViewHandler.java:146)
    at org.eclipse.ui.handlers.ShowViewHandler.openOther(ShowViewHandler.java:102)
    at org.eclipse.ui.handlers.ShowViewHandler.execute(ShowViewHandler.java:70)
    at org.eclipse.ui.internal.ShowViewMenu$3.run(ShowViewMenu.java:113)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:996)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:538)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:278)
    at org.eclipse.core.launcher.Main.run(Main.java:973)
    at org.eclipse.core.launcher.Main.main(Main.java:948)
      

  3.   

    <?xml version="1.0" encoding="GB2312"?>
    <?eclipse version="3.0"?>
    <plugin>
    <runtime>  
               <library  name="commons-beanutils.jar">  
                     <export  name="*"/>  
               </library>  
     <library  name="commons-collections.jar">  
                     <export  name="*"/>  
               </library>  
     <library  name="commons-digester.jar">  
                     <export  name="*"/>  
               </library>  
     <library  name="commons-lang.jar">  
                     <export  name="*"/>  
               </library>  
    <library  name="commons-logging.jar">  
                     <export  name="*"/>  
               </library>  
     <library  name="dom4j-1.5.2.jar">  
                     <export  name="*"/>  
               </library>  
    <library  name="freeer.jar">  
                     <export  name="*"/>  
               </library>  
     <library  name="jaxen-1.1-beta-4.jar">  
                     <export  name="*"/>  
               </library>  
     <library  name="log4j.jar">  
                     <export  name="*"/>  
               </library>  
    <library  name="xercesImpl.jar">  
                     <export  name="*"/>  
               </library>   <library  name="xmlParserAPIs.jar">  
                     <export  name="*"/>  
               </library>  
    </runtime> 
     <requires>
          <import plugin="org.eclipse.ui"/>
          <import plugin="org.eclipse.swt"/>
          <import plugin="org.eclipse.core.runtime"/>
          <import plugin="org.eclipse.jface.text"/>
          <import plugin="org.eclipse.ui.editors"/>
          <import plugin="org.eclipse.ui.workbench.texteditor"/>
       </requires>
    <extension point="org.eclipse.ui.perspectives">
          <perspective name="框架类生成助手" icon="icons/sample.gif" class="com.zhjy.helper.view.MainPerspective" id="com.zhjy.helper.view.MainPerspective">
          </perspective>
       </extension>
       
        <extension
             point="org.eclipse.ui.views">
          <category
                name="框架类生成助手"
                id="zhjy.view">
          </category>
          <view
                name="Hibernate配置文件列表"
                icon="icons/prev.gif"
                category="zhjy.view"
                class="com.zhjy.helper.navigator.NavigatorView"
                id="com.zhjy.helper.navigator.NavigatorView">
          </view>
          <view
                name="生成文件"
                icon="icons/project.gif"
                category="zhjy.view"
                class="com.zhjy.helper.view.CreateFileView"
                id="com.zhjy.helper.view.CreateFileView">
          </view>
          
          <view
                name="设置文件的路径"
                icon="icons/selectall.gif"
                category="zhjy.view"
                class="com.zhjy.helper.view.InitPathView"
                id="com.zhjy.helper.view.InitPathView">
          </view>
       </extension>
       <!-- END -->
       
       <!-- 加入首选项 -->
    <extension point="org.eclipse.ui.preferencePages">
    <page 
      name="路径的初始化"
      class="com.zhjy.helper.preferences.FilePathPreferencePage"
      id="com.zhjy.helper.preferences.FilePathPreferencePage">
    </page>
    </extension>
     <!-- 编辑显示-->
       <extension
             point="org.eclipse.ui.editors">
          <editor
                name="配置文件显示"
                icon="icons/a.gif"
                class="com.zhjy.helper.edits.ConfigEditor"
                id="com.zhjy.helper.edits.ConfigEditor">
          </editor>
       </extension>
     
       <!-- END -->
    </plugin>