Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin dropping stderr output silently #142

Closed
cowwoc opened this issue Jan 21, 2015 · 3 comments
Closed

Plugin dropping stderr output silently #142

cowwoc opened this issue Jan 21, 2015 · 3 comments

Comments

@cowwoc
Copy link
Contributor

cowwoc commented Jan 21, 2015

The plugin is dropping stderr output. This is 100% reproducible.

Repro steps:

  1. Create gulpfile.js containing:
var gulp = require("gulp");
gulp.task("default", ["non-existent"]);

2.. Configure Maven as follows:

<plugin>
    <groupId>com.github.eirslett</groupId>
    <artifactId>frontend-maven-plugin</artifactId>
    <version>0.0.20</version>
    <executions>
        <execution>
            <id>install-node-and-npm</id>
            <goals>
                <goal>install-node-and-npm</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
                <nodeVersion>v0.10.28</nodeVersion>
                <npmVersion>1.4.9</npmVersion>
            </configuration>
        </execution>
        <execution>
            <id>install-npm-dependencies</id>
            <goals>
                <goal>npm</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
                <arguments>install</arguments>
            </configuration>
        </execution>
        <execution>
            <id>gulp</id>
            <goals>
                <goal>gulp</goal>
            </goals>
            <phase>process-resources</phase>
            <configuration>
                <arguments>build</arguments>
            </configuration>
        </execution>
    </executions>
    <configuration>
        <workingDirectory>src/test/resources</workingDirectory>
    </configuration>
</plugin>

3.. Build the project.
4.. Maven fails with:

--- frontend-maven-plugin:0.0.20:gulp (gulp) @ frontend ---
Running 'gulp build --no-color' in ~/foo/frontend/src/test/resources
[14:46:56] Using gulpfile ~/foo/frontend/src/test/resources/gulpfile.js
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 10.623s
Finished at: Wed Jan 21 14:46:56 EST 2015
Final Memory: 11M/277M
------------------------------------------------------------------------
Failed to execute goal com.github.eirslett:frontend-maven-plugin:0.0.20:gulp (gulp) on project frontend: Failed to run task: 'gulp build --no-color' failed. (error code 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.eirslett:frontend-maven-plugin:0.0.20:gulp (gulp) on project frontend: Failed to run task
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to run task
    at com.github.eirslett.maven.plugins.frontend.mojo.GulpMojo.execute(GulpMojo.java:66)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: com.github.eirslett.maven.plugins.frontend.lib.TaskRunnerException: 'gulp build --no-color' failed. (error code 1)
    at com.github.eirslett.maven.plugins.frontend.lib.NodeTaskExecutor.execute(NodeTaskExecutor.java:38)
    at com.github.eirslett.maven.plugins.frontend.mojo.GulpMojo.execute(GulpMojo.java:64)
    ... 21 more

5.. Run gulp manually from command-line:

# gulp
[14:49:57] Using gulpfile ~/foo/frontend/src/test/resources/gupfile.js
[14:49:57] Task 'non-existent' is not in your gulpfile
[14:49:57] Please check the documentation for proper gulpfile formatting

Expected behavior: Maven should output the 3 lines shown above.

@cowwoc
Copy link
Contributor Author

cowwoc commented Jan 22, 2015

It looks like there is some sort of race condition that causes the last line or two sent to stderr to never get printed.

@eirslett
Copy link
Owner

Hmm... It's s clumsy implementation of log forwarding, I'm not sure if there's a library that can do it better...

@cowwoc
Copy link
Contributor Author

cowwoc commented Jan 23, 2015

It turns out that we're actually losing lines sent to stdout, not stderr. I tracked the down problem to nodejs/node-v0.x-archive#8329; therefore, it is not fixable.

That said, I discovered a minor bug in your stderr-handling code. I will publish a PR soon.

eirslett added a commit that referenced this issue Jan 30, 2015
ProcessExecutor was logging stderr to stdout log #142
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants