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

Node keeps running when killing maven #41

Closed
fpoliquin opened this issue Mar 4, 2014 · 10 comments · Fixed by #561
Closed

Node keeps running when killing maven #41

fpoliquin opened this issue Mar 4, 2014 · 10 comments · Fixed by #561

Comments

@fpoliquin
Copy link

When running a Grunt watch task and hitting "Ctrl-C" to stop the process. Node.exe keeps running in the background.

I haven't found a way to kill node.exe other than going manually in the task manager...

We are using a watch task to compile sass files in the background.

@eirslett
Copy link
Owner

eirslett commented Mar 5, 2014

Are you running Grunt through Maven, or directly via the grunt command? (In that case, via the helper scripts?)

@fpoliquin
Copy link
Author

Through Maven using a custom profile. Something like:

mvn generate-resources -PwatchSass

@eirslett
Copy link
Owner

eirslett commented Mar 6, 2014

I see. Is there a reason why you don't just run "grunt watch" directly? (using the helper scripts you find in this repo)

@fpoliquin
Copy link
Author

I use it this way to get access to some variables that are set in my settings.xml. For example, to run cssmin or not etc.

Our gruntfile is quite dynamic.

@jzelenkov
Copy link

Here're my 2 cents.

We use frontend-maven-plugin in a small team in production. There is a big temptation to configure both backend and frontend related tools in pom.xml or some sort of a settings file used by maven.

In fact, before we discovered this plugin, we were using a bunch of maven-whatever-plugins to minify js and css, to compile coffeescript etc. That was just not working out for us. These maven plugins were too complex, required a lot of configuration and were not playing very well with each other. And virtually every single one of them assumed that the needed frontend tools are available in PATH.

The whole point of frontend-maven-plugin IMHO is to separate backend and frontend concerns in a project. This way backend guys can use pom.xml to configure their stuff and frontend guys can leverage the power of modern frontend tools like grunt, bower, karma etc. We keep frontend config in frontend files. Maven doesn't know anything about it other than it should run frontend-maven-plugin.

@fpoliquin
Copy link
Author

I understand what you are saying but those "modern" frontend tools forces us to separate our environment configurations, don't provide any good packaging, don't provide private referential or any private sharing mechanism nor does it provide any server side compilation. With Maven, we are able to unify the build system for all of this (invoking Grunt where needed).

I agree that right now there are no good plugin available for client side development in the Maven world but the philosophy is still much better than Grunt where I have the impression of going back 10 years with scons or Ant.

By playing with Maven and the frontend plugin, we were able to do something like :
<dependency>
<groupId>my private groupid</groupId>
<artifactId>angularjs</artifactId>
<version>1.2.12</version>
<type>zip</type>
</dependency>

And start using angularjs without writing anything else - no Gruntfile, no package.json. Both files were written once and are inherited by a parent pom.

@eirslett
Copy link
Owner

@jzelenkov is right about the separation being a goal in itself - but many of us don't live in an ideal world, and I've felt the pain of Gruntfiles that depend on external variables, like the ones coming from Maven.

I consider this a bug that has to be fixed; but I'm open for suggestions/pull requests on how to fix it!

@CharlieC3
Copy link

I'm seeing a similar bug with Node. After running Karma through Node with the frontend plugin, Node does not stop once the build ends, regardless of the build result. This prevents us from running another build without manually stopping the Node process in the task manager. Is this bug actively being worked on?

@eirslett
Copy link
Owner

Hmm, not good :-/
I'm not looking at it for the time being, but you're free to send a PR if you can figure out why it happens! (Maybe a setDaemon(true) or setDaemon(false) configuration on the thread would fix it? I don't remember the syntax from the top of my head)

tjuerge added a commit to tjuerge/frontend-maven-plugin that referenced this issue Jan 21, 2016
…-exec

By using commons-exec instead of ProcessBuilder we can support killing
the Node process if the Maven build is stopped. An optional timeout can
be specified (not exposed to the task runners yet).

A workaround for eirslett#343 is implemented as well.
tjuerge added a commit to tjuerge/frontend-maven-plugin that referenced this issue Jan 22, 2016
tjuerge added a commit to tjuerge/frontend-maven-plugin that referenced this issue Jan 22, 2016
@mriehema mriehema mentioned this issue Mar 10, 2016
@jrauschenbusch
Copy link

Same problem here.

What is with the possible solution of @tjuerge? Isn't it possible to merge it or isn't it a real solution?
tjuerge/frontend-maven-plugin/tree/feature/commons-exec

eirslett added a commit that referenced this issue Mar 10, 2017
#41 Replaced ProcessBuilder usage with commons-exec
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

Successfully merging a pull request may close this issue.

5 participants