我正在尝试运行无头 Eclipse 构建,但我被卡住了。我的上下文是我想使用 PyDev 代码分析而不必启动 eclipse gui。我知道其他用于进行代码分析的命令行工具(pyflakes、pylint 等)。
到目前为止我的命令是:
java -jar /path/to/eclipse/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar -noSplash -data "/path/to/workspace" -application org.eclipse.jdt.apt.core.aptBuild
我的java版本是1.6.0_31,我的eclipse版本是3.7.2,我的pydev版本是2.5.0。
当我运行该命令时,它看起来正在运行,但它从未捕获任何错误或警告。
...
PyDev: Analyzing 29 of 33 (forms.py)
PyDev: Analyzing 29 of 33 (forms.py)
PyDev: Analyzing 29 of 33 (forms.py)
PyDev: Analyzing 29 of 33 (forms.py)
...
如果 I tail -f /path/to/workspace/.metadata/.log
,我会得到一个巨大的堆栈跟踪:
!ENTRY org.eclipse.equinox.preferences 4 2 2012-07-30 17:48:39.612
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.equinox.preferences".
!STACK 0
java.lang.ExceptionInInitializerError
at org.eclipse.debug.internal.ui.DebugUIPreferenceInitializer.setDefault(DebugUIPreferenceInitializer.java:186)
at org.eclipse.debug.internal.ui.DebugUIPreferenceInitializer.setThemeBasedPreferences(DebugUIPreferenceInitializer.java:204)
at org.eclipse.debug.internal.ui.DebugUIPreferenceInitializer.initializeDefaultPreferences(DebugUIPreferenceInitializer.java:79)
at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper$1.run(PreferenceServiceRegistryHelper.java:281)
..... TRUNCATED ......
!ENTRY org.eclipse.osgi 4 0 2012-07-30 17:48:39.622
!MESSAGE An error occurred while automatically activating bundle org.eclipse.debug.ui (42).
!STACK 0
org.osgi.framework.BundleException: Exception in org.eclipse.debug.internal.ui.DebugUIPlugin.start() of bundle org.eclipse.debug.ui.
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
..... TRUNCATED .......
java.lang.IllegalStateException: Workbench has not been created yet.
at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:92)
at org.eclipse.debug.internal.ui.contextlaunching.LaunchingResourceManager.startup(LaunchingResourceManager.java:546)
at org.eclipse.debug.internal.ui.DebugUIPlugin.getLaunchingResourceManager(DebugUIPlugin.java:315)
at org.eclipse.debug.internal.ui.DebugUIPlugin.start(DebugUIPlugin.java:516)
..... TRUNCATED ......
!ENTRY org.eclipse.osgi 4 0 2012-07-30 17:48:39.624
!MESSAGE An error occurred while automatically activating bundle org.eclipse.debug.core (41).
!STACK 0
org.osgi.framework.BundleException: Exception in org.eclipse.debug.core.DebugPlugin.start() of bundle org.eclipse.debug.core.
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
..... TRUNCATED ......
我怀疑 PyDev 需要 gui 来呈现错误/警告。