我需要开发一个Eclipse插件,但我更喜欢使用IntelliJ IDEA作为IDE。有没有可能配置IDEA以进行Eclipse插件开发?
我需要开发一个Eclipse插件,但我更喜欢使用IntelliJ IDEA作为IDE。有没有可能配置IDEA以进行Eclipse插件开发?
使用 Eclipse Tycho 应该是可行的。
你将使用Maven,并且这与IntellIj完美配合。
Tycho专注于基于Maven、以清单为先的方法来构建Eclipse插件、特性、更新站点、RCP应用和OSGi包。Tycho是一组Maven插件和扩展,用于使用Maven构建Eclipse插件和OSGi包。
使用Osmorc或许是可能的,但我没有尝试过。然而,我有一种方法可以实现(在 IntelliJ 2017.1 上),但其他版本也应该类似。它不需要使用 Eclipse Tycho,因为我的插件使用了 XCore,这似乎与 Tycho 不兼容。
在IntelliJ中
打开项目结构(Ctrl + Alt + Shift + S)
/opt/eclipse/plugins
目录(或者eclipse安装的任何位置)ECLIPSE
库作为最后一个依赖项。Open up the Debug perspective. You should see something like this:
Right click > properties on the /usr/lib/jvm/...
(may be different Java JVM)
Copy the Command Line:
Elsewhere, in your favorite editor, make a new bash file (I put this file in my IntelliJ project folder), and paste this command in there.
Note that when Eclipse runs the command, it runs from a working directory of /opt/eclipse/
(or wherever eclipse is installed), so we need to add a cd /opt/eclipse/
beforehand. Let's do it in a new shell as well:
(cd /opt/eclipse && /usr/lib/jvm/java-8-oracle/bin/java ...)
If this bash script is run, it should be the same as if we ran from Eclipse.
In IntelliJ, create a new Bash run configuration (Alt + Shift + F10 > Edit Run Configurations). Make the "Script:" field contain the path to the bash file we just created.
Also, add "Build Project" to the "Before launch" options.
Additionally, tick the "Single instance only" box.
Copy the "Command line arguments for running remote JVM". For me that is
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
I liked the workflow for suspend=y
better; basically it means that the eclipse application won't start up until we attach the debugger.
Copy your bash file and add these arguments:
(cd /opt/eclipse && /usr/lib/jvm/java-8-oracle/bin/java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 ...)
Add another Bash run configuration for IntelliJ that runs this new script (and also runs "Build Project" beforehand, and is "Single instance only").
目前,唯一需要Eclipse的是编辑我的.xcore
文件,因为Eclipse可以从中生成Java代码,而XCore没有办法从终端运行。