eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.26k stars 872 forks source link

Eclipse building workspace forever #200

Open celsomarques opened 9 years ago

celsomarques commented 9 years ago

Hi folks,

This configuration <runOnIncremental>true</runOnIncremental> for goals such as: npm, gulp, etc, makes Eclipse building workspace forever.

I'm using Eclipse Luna 4.4.0.

To solve this issue I included on pom.xml

<build>
...
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-dependency-plugin</artifactId>
                                    <versionRange>[2.4,)</versionRange>
                                    <goals>
                                        <goal>npm</goal>
                                        <goal>gulp</goal>
                                        <goal>grunt</goal>
                                        <goal>bower</goal>
                                        <goal>ember</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute>
                                        <runOnIncremental>false</runOnIncremental>
                                    </execute>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
...
</build>

Is it possible to change that directly on your project?

Best, Celso

eirslett commented 9 years ago

Could you try and make a "minimal" example where this is happening, and put it on your GitHub account? Then we can try and reproduce it, and figure out what's happening.

Athou commented 9 years ago

This seems to happen with https://github.com/Athou/commafeed now too.

haodut commented 8 years ago

I have encountered this problem. This is my Gruntfile.js

module.exports = function(grunt) {
    grunt.initConfig({
        jshint: {
            files: ['Gruntfile.js', 'src/main/webapp/*.js']
        },
        bower: {
            install: {
                options: {
                    targetDir: "src/main/webapp/jslib",
                    layout: "byComponent",
                    install: false,
                    verbose: false,
                    cleanTargetDir: false
                }
            }
        }
    });
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-bower-task');
    grunt.registerTask('default', ['jshint', 'bower']);
};

Eclipse's "Build Automatically" is checked. When I open a file in targetDir of grunt-bower-task(“src/main/webapp/jslib”), the project will build at once. If the web server is running, the project will build forever.

dreignier commented 8 years ago

Same problem here. The problem is that when eclipse start a build, the frontend maven plugin run npm, bower and gulp as command lines. So Eclipse think that external tools just changed something in its workspace. So a new build is triggered. And you have a "infinite building loop".

daniel-alonso-sanchez commented 8 years ago

Same problem here!

dpalic commented 7 years ago

same problem here on neon

paolodenti commented 7 years ago

I had the same problem and I found a solution working for me. First of all, this is not an issue of the plugin.

What happens is that if your gruntfile (or whatever you use) runs a minify/uglify, even if there are no differences in the source file and in the generated target file, at system level the file is anyway saved and written, even if with the same content. So if your workspace is refreshed by using "native hooks" it feels the file change, even if the content is the same. Disabling the native hooks it works but of course you lose the native hooks capabilities. A better solution is to uglify or minify only if really needed, only if the source file changes.

What i did is to use the grunt-changed plugin, just changing from

    grunt.registerTask('default', [ 'uglify', 'cssmin' ]);

to

    grunt.loadNpmTasks('grunt-changed');
    grunt.registerTask('default', [ 'changed:uglify', 'changed:cssmin' ]);

In such a way the target file is not rewritten by an identical copy and therefore it does not trigger the build