Eclipse命令行插件

时间:2009-10-29 09:16:17

标签: eclipse shell command-line build scripting

我需要一个Eclipse插件在Linux下运行shell脚本。我有一个漂亮的Rsync脚本,我想在Eclipse中使用一个按钮来激活它。

最好的解决方案是,如果我在保存Stuff时也激活了Rsync shell脚本,那么也许我可以添加一个脚本生成器或类似的东西。

任何人都有解决这两种解决方案的线索吗?

2 个答案:

答案 0 :(得分:7)

您可以使用日食external tools feature。对于运行位置字段/bin/sh中的shell脚本,参数应该是shell脚本本身。

如果要在保存时运行脚本,可以使用Eclipse的内部构建器。

项目 - >属性 - >建设者 - >新... - >程序

请务必在“构建选项”标签上查看“清理后”,“自动构建期间”选项。

答案 1 :(得分:0)

我现在正在使用Netbeans!

7.0 Beta有一个很好的包含命令行使用公钥的FTP / SFTP支持适用于Linux和PHP

我很想改变,但现在我比Eclipse更喜欢它。我唯一想念的是我真正快速的Rsync脚本,但是需要关心的一件事是什么!

# !/bin/sh

#Important Notes:
# 0) Requrirements: RSYNC and SSH support on your Machine (install cygwin under windows, all good OS should already have it)
# 1) You have to configure your ssh so yout do not have to enter the Password and the Port for your Server
# 2) You have to edit the Paths and directorys to fit your Environment
# 3) You may be interested in changing some RSYNC Options
# 4) You may want to add this Script as Eclipse Builder to be run on autosave, to always keep your Server in sync.

如果有人想在Eclipse中使用它,那么这是脚本。

您只需在Eclipse中设置一些环境变量($ USER等)。在我找到Netbeans之前,我一直都很棒。

# Push: rsync [OPTION...] SRC... [USER@]HOST:DEST

# Useful rsync Options
# -v verbose
# -q quiet, supress non-error Messages
# -r recursive, recurse sub-directorys
# -u update, skip files that are newer on the server
# -E preserve Executability
# --chmod=CHMOD directory permissions to be set
# -z compress file data during transfer
# --compress-level NUM explicitly set compression level
# --skip-compress=LIST skip compressing files with suffix in list (for jpg, png)
# --exclude=PATTERN (for svn and eclipse config files)
# --port (maybe we want a weird port)
# -h output numbers in a human readable format (that is always good)
# --progress (may be interesting)
# --password-file read daemon-access password from file
# --bwlimit=KBPS bandwith limit
# -t transfer the modification times with the files ... makes next transfer more effective
# --delete delete files that do not exist on other side
# -C cvs-exclude - exclude RCS   SCCS   CVS   CVS.adm   RCSLOG  cvslog.*  tags  TAGS .make.state .nse_depinfo *~ #* .#* ,* _$* *$ *.old  *.bak *.BAK  *.orig *.rej .del-* *.a *.olb *.o *.obj *.so *.exe *.Z *.elc *.ln core .svn/ .git/ .bzr/
# --stats ... could be interesting

TARGET_HOST="www.example.com"
TARGET_DIR="/var/www/"
TARGET_USER="root"

SOURCE_DIR="/home/user/workspace/myeclipseproject/"

#Make this Variable empty if you do not want nonexisting Files on the Server to be deleted
#DELETE=" --delete"
DELETE=""

OPTIONS=" -r -u -E -z -h --progress -t --stats --chmod=a+rwx --exclude-from=exclude.txt --chmod=a+rwx "$DELETE

COMMAND="$OPTIONS  $SOURCE_DIR $TARGET_USER@$TARGET_HOST:$TARGET_DIR"
echo 'rsync '$COMMAND
rsync  $COMMAND