grunt插件来刷新eclipse的java项目 [英] grunt plugin to refresh eclipse java project

查看:308
本文介绍了grunt插件来刷新eclipse的java项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:



我有一个使用lesscss的java项目。
我正在使用 grunt grunt-contrib-watch grunt-contrib无论如何编译我的 .less 文件到 .css`。



工作很好。



问题是要让eclipse tomcat服务器开始提供更新的 .css 文件需要刷新eclipse中的项目。



如果有办法强制eclipse刷新作为手表的一部分,我正在徘徊。 c $ c>循环咕噜?
或实际上,有没有办法导致当前打开的eclipse项目(鉴于我知道它的路径,如果它有帮助)刷新使用grunt。将其连接到手表周期并不困难,可以通过从以下方式更改我的 Gruntfile.js 来完成此操作:

  watch:{
styles:{
//哪些文件手表(所有的文件递归在less目录中)
文件:['../WebContent/less/**/*.less'],
任务:['less'],
选项:{
nospawn:true
}
},

to:

  watch:{
styles:{
/ /哪些文件要在哪个文件中递归递送
文件:['../WebContent/less/**/*.less'],
任务:['less' ,'updateEclipseTask'],
选项:{
nospawn:true
}
},


解决方案

尝试启用首选项>一般>工作区>刷新使用本机钩子或轮询。根据您使用的操作系统,它将快速刷新。这不是你想要的,但它可能会解决问题。



另一个我没有尝试过自己但是看起来像这样可以工作的选项是使用 eclipse-remote-control 可触发您拥有的外部命令在Eclipse中设置(运行>外部工具>外部工具配置... ),如果您创建一个新的程序配置,您可以在刷新选项卡设置Eclipse在执行外部工具配置时刷新工作空间。



要从grunt运行eclipse远程控制,您可以使用 grunt-shell


Background:

I have a java project that uses lesscss. I am using grunt with grunt-contrib-watch and grunt-contrib-less to compile my.lessfiles to.css`.

It all works nicely.

The issue is that to get the eclipse tomcat server to start serving the updated .css files I need to refresh the project in eclipse.

I was wandering if there is a way to force eclipse to refresh as part of the watch cycle in grunt ? or actually, is there a way to cause the currently open eclipse project ( given that I know its path if it helps ) to refresh using grunt.

Connecting it to the watch cycle is not hard and can be probably done by changing my Gruntfile.js from:

    watch: {
        styles: {
            // Which files to watch (all .less files recursively in the less directory)
            files: ['../WebContent/less/**/*.less'],
            tasks: ['less'],
            options: {
              nospawn: true
            }
        },

to:

    watch: {
        styles: {
            // Which files to watch (all .less files recursively in the less directory)
            files: ['../WebContent/less/**/*.less'],
            tasks: ['less','updateEclipseTask'],
            options: {
              nospawn: true
            }
        },

解决方案

Try enabling Preferences > General > Workspace > Refresh using native hooks or polling. Depending on what OS you're using it will refresh more or less quickly. It's not exactly what you want but it might solve the problem.

Another option that I haven't tried myself but that looks like it could be made to work is to use eclipse-remote-control to trigger an external command you have set up in Eclipse (Run > External Tools > External Tools Configurations...), if you create a new "Program" configuration there you can in the "Refresh" tab set Eclipse to refresh the workspace when that external tool config is executed.

To run eclipse-remote-control from grunt you could use grunt-shell.

这篇关于grunt插件来刷新eclipse的java项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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