如何配置Eclipse来运行一个外部制造商或shell命令? [英] How can I configure Eclipse to run an external builder or shell command?

查看:271
本文介绍了如何配置Eclipse来运行一个外部制造商或shell命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够运行在Eclipse外部外壳工具,特别是建设者。我该如何设置Eclipse,因此需要构建时,外部命令获取运行?另外,我怎么可以配置Eclipse这样我可以告诉它根据需要手动运行外部命令?

I want to be able to run external shell tools from within Eclipse, especially builders. How can I set up Eclipse so an external command gets run when a build is needed? Also, how can I configure Eclipse so that I can tell it to run an external command manually on demand?

什么引发了这方面的需求是,我希望能够从Eclipse执行SBT版本。我知道ScalaIDE的,但它并没有为我的Andr​​oid开发工作。

What sparked this need was that I want to be able to perform an sbt build from within Eclipse. I am aware of ScalaIDE, but it doesn't work for my Android development.

推荐答案

下面就是我如何与SBT和Android的插件presently这样做。这些说明将同样适用于任何类型的外部工具,你想在Eclipse中运行。

Here's how I am doing it with sbt and the android-plugin presently. These instructions will apply equally well to any kind of external tool you'd like to run from within Eclipse.

这是可能的,要求开发人员手动启动构建或治疗构建为一个Eclipse建设者。建筑商可以配置各种触发运行(一个手工打造,干净的构建,文件保存后,等)

It's possible to require the developer to start the build manually or to treat the build as an Eclipse builder. The builder can be configured to run by various triggers (a manual build, clean build, after file save, etc.)

要配置SBT为建设者运行:

To configure sbt to run as builder:


  1. 导入您的SBT项目到Eclipse中。 (请参见这个答案。)

右键点击SBT项目,单击属性。

Right-click on the sbt project, click properties.

点击下建设者项目类型过滤文本

取消选中或删除Java的建设者。如果不这样做,可能会与外部干扰建设者。如果外部工具是不是建筑,而是做一些生成后,你可以离开了Java建设者。

Uncheck or remove the Java builder. If you don't, it may interfere with the external builder. If your external tool isn't building, but doing something post-build, you can leave the Java builder.

点击新建按钮。选择程序,然后单击确定。

Click the New button. Select Program, and click OK.

在编辑配置窗口中,在名称字段的建设者输入一个名称。

In the Edit Configuration window, enter a name for the builder in the name field.

有关的位置,浏览到您的Java可执行文件。如果你不知道它在哪里或Java可执行您正常使用,看看你通常用来运行SBT脚本。

For the location, browse to your java executable. If you're not sure where it is or which java executable you normally use, take a look at the script you normally use to run sbt.

选择在工作目录字段中输入SBT项目的根目录。如果你已经在Eclipse中的SBT项目,您可以浏览工作区,否则浏览文件系统找到它。

Choose the root directory of your sbt project in the Working Directory field. If you already have your sbt project in Eclipse, you can browse workspace, otherwise browse the file system to find it.

在参数字段中,粘贴的Java参数的路径 SBT-launch.jar (再次,看你平时的命令行SBT启动脚本)你想SBT执行加任何命令。例如,在Windows上使用:
-Djline.terminal = jline.UnixTerminal -XX:MaxPermSize参数=256米-Xmx512M -XX:+ CMSClassUnloadingEnabled -jar C:/ cygwin中的/ home / [用户名] /bin/sbt-launch.jar安卓包-debug安卓:启动模拟器

In the arguments field, paste Java parameters, the path to your sbt-launch.jar (again, see your usual command-line sbt launch script) plus whatever commands you want sbt to perform. For example, on Windows I use: -Djline.terminal=jline.UnixTerminal -XX:MaxPermSize=256m -Xmx512M -XX:+CMSClassUnloadingEnabled -jar c:/cygwin/home/[username]/bin/sbt-launch.jar android:package-debug android:start-emulator

如果您正在为Android,您需要创建一个新的环境变量来表示了Android SDK位于何处。单击环境选项卡上,单击新建,然后在名称字段中填入 ANDROID_SDK_R​​OOT 和路径到Android SDK的价值。

If you're building for Android, you'll need to create a new environment variable to indicate where the Android SDK is located. Click on the environment tab, click New, and then fill in the name field with ANDROID_SDK_ROOT and the value with the path to your Android SDK.

点击编译选项卡上,并在您想运行建设者什么样的条件进行选择。

Click on the build options tab and choose under what conditions you'd like to run the builder.

要自行配置SBT为明确要求时,将只运行一个外部程序运行:


To instead configure sbt to run as an external program that will only be run when explicitly requested:


  1. 在Eclipse中,查找工具栏为具有在右下角一个手提箱的图片运行按钮。单击它并选择外部工具配置。

  1. From Eclipse, look on the toolbar for a run button that has a picture of a suitcase on the lower-right corner. Click it and select "External Tools Configurations".

在外部工具配置窗口中,单击下的类型过滤文本框中的程序项。

In the External Tools Configurations window, click the Program item under the "type filter text" box.

点击的外部工具配置窗口左上角的新的启动配置图标。

Click the "New Launch Configuration" icon on the top-left corner of the External Tools Configurations window.

在名称字段中输入配置的名称。

Enter a name for the configuration in the name field.

有关的位置,浏览到您的Java可执行文件。如果你不知道它在哪里或Java可执行您正常使用,看看你通常用来运行SBT脚本。

For the location, browse to your java executable. If you're not sure where it is or which java executable you normally use, take a look at the script you normally use to run sbt.

选择在工作目录字段中输入SBT项目的根目录。如果你已经在Eclipse中的SBT项目,您可以浏览工作区,否则浏览文件系统找到它。

Choose the root directory of your sbt project in the Working Directory field. If you already have your sbt project in Eclipse, you can browse workspace, otherwise browse the file system to find it.

在参数字段中,粘贴的Java参数的路径 SBT-launch.jar (再次,看你平时的命令行SBT启动脚本)你想SBT执行加任何命令。例如,在Windows上使用:
-Djline.terminal = jline.UnixTerminal -XX:MaxPermSize参数=256米-Xmx512M -XX:+ CMSClassUnloadingEnabled -jar C:/ cygwin中的/ home / [用户名] /bin/sbt-launch.jar安卓包-debug安卓:启动模拟器

In the arguments field, paste Java parameters, the path to your sbt-launch.jar (again, see your usual command-line sbt launch script) plus whatever commands you want sbt to perform. For example, on Windows I use: -Djline.terminal=jline.UnixTerminal -XX:MaxPermSize=256m -Xmx512M -XX:+CMSClassUnloadingEnabled -jar c:/cygwin/home/[username]/bin/sbt-launch.jar android:package-debug android:start-emulator

如果您正在为Android,您需要创建一个新的环境变量来表示了Android SDK位于何处。单击环境选项卡上,单击新建,然后在名称字段中填入 ANDROID_SDK_R​​OOT 和路径到Android SDK的价值。

If you're building for Android, you'll need to create a new environment variable to indicate where the Android SDK is located. Click on the environment tab, click New, and then fill in the name field with ANDROID_SDK_ROOT and the value with the path to your Android SDK.

然后推出,只需点击应用,然后点击运行。在未来,你可以再次点击与手提箱运行按钮,直接挑的配置。

Then to launch, just click apply then click run. In the future, you can just click the run button with the suitcase again and pick the configuration directly.

这篇关于如何配置Eclipse来运行一个外部制造商或shell命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆