MattCheely / requirejs-maven-plugin

Maven plugin for RequireJS optimization
GNU Lesser General Public License v2.1
66 stars 21 forks source link

RequireJS errors are not propagated to the Maven cycle #5

Closed emmerich closed 11 years ago

emmerich commented 11 years ago

If you run the Maven project and have errors in your dependencies - such as referencing a dependency where the file doesn't exist - the plugin reports errors to the console, but doesn't halt the Maven build. In areas like continuous integration where you might not be monitoring the build output, this can cause builds to succeed when they really shouldn't.

Is this an issue with the plugin not picking up errors in RequireJS and reporting them to the Maven cycle, or an issue with my configuration?

MattCheely commented 11 years ago

This sounds like an issue with the plugin. The intent is for errors to fail the build. Are you using the bundled version of r.js or an external version? If it's external, what version are you using?

emmerich commented 11 years ago

We're using an external version, at 2.1.1. If I get some free time I'll try to get a minimum test case sorted to look into it (never debugged Maven plugins before)

emmerich commented 11 years ago

I'm unable to reproduce a basic case where this occurs, but we see it when we run our build through continuous integration (using Continuum). I'll leave it for now, if I get any more information as to why it's happening I'll post.

MattCheely commented 11 years ago

I believe I've seen this as well recently. I will try to clear away some time to take a closer look soon. We've got a new baby at home so that's (happily) cutting into my time for other things.

emmerich commented 11 years ago

Fair enough. The error occurred when I had a requirement on a module that existed, but the casing was incorrect. I tested it on the following platforms:

Windows 8 - worked fine, the build broke the maven cycle Linux Mint - worked fine, the build broke the maven cycle Continuum's server (running CentOS) - errors were detected, but it didn't break the Maven build

Hope this helps, let me know if there's any more information I can provide

MattCheely commented 11 years ago

It looks like the exception thrown due to a non-zero exit status from r.js was somehow getting swallowed by Rhino. I think I've fixed the issue in the latest snapshot release here: https://oss.sonatype.org/content/repositories/snapshots/com/github/mcheely/requirejs-maven-plugin/

Can you give it a try and let me know if it resolves the problem for you?

emmerich commented 11 years ago

Unfortunately I don't have the ability to use snapshots of plugins in our CI environment (where I'd be able to test it breaks). I'll watch this issue, if you could post when you release 1.0.5, I can test it properly then.

MattCheely commented 11 years ago

I just released version 1.1.0. It contains the fix for this issue, and also changes the plugin's behavior to create filtered build config files in the project's build directory to make it easier to see what the filtered profile looks like.

I released it on sonatype, so it may be a day or so before you see it in maven central. Let me know how it works.

emmerich commented 11 years ago

Sorry for the delay. We finally got a chance to put this in and pleased to say that our builds are breaking properly when we have incorrect casing in RequireJS dependencies. Thanks!