grunt插件刷新Eclipse Java项目

epe*_*leg 4 eclipse gruntjs

背景:

我有一个使用lesscss的Java项目。我使用gruntgrunt-contrib-watchgrunt-contrib-less to compile my.LESS files to.css`。

一切都很好。

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

我在徘徊,是否有一种方法可以使日蚀watch在咕unt声中作为周期的一部分进行刷新?或者实际上,是否有办法使用grunt刷新当前打开的eclipse项目(鉴于我知道它的路径,如果有帮助的话)。

将其连接到手表周期并不难,并且可以通过更改以下项来完成Gruntfile.js

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

至:

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

Aul*_*ule 5

尝试启用Preferences > General > Workspace > Refresh using native hooks or polling。根据您所使用的操作系统,它会或多或少地刷新。这不是您想要的,但可以解决问题。

我还没有尝试过但看起来可以使用的另一种选择是,如果创建新的“程序”配置,则使用eclipse-remote-control触发您在Eclipse(Run > External Tools > External Tools Configurations...)中设置的外部命令在那里,您可以在“刷新”选项卡中将Eclipse设置为在执行该外部工具配置时刷新工作空间。

要从grunt 运行eclipse-remote-control,可以使用grunt-shell