title: How do I start Maven "compile" goal on save in Eclipse?
body: <p>I have a Maven project with JavaScript code. There is a special javascript compiler plugin connected to the compile goal in the pom.xml. So when I type "mvn compile" then the JavaScript sources in src/main/javascript are compiled (compressed and obfuscated) and saved into the target/classes directory. On the command line this works great.</p>
  
  <p>But now I want to make the development easier by using Eclipse with the m2eclipse plugin. I want Eclipse to call the compile goal whenever I change a JavaScript file. How can I do this? When I save a JavaScript file then I just see a "AUTO_BUILD" logging line in the maven console and that's it.</p>
  
  <p>In the project preferences it is possible to configure a lifecycle mapping. But for some reason I can only add custom goals to "after clean" and "on resource changed". When I add the "compile" goal to the "resource changed" lifecycle mapping, then the JavaScript files are compiled when I change a resource. So I could put my JavaScript files into the resources folder instead and it would work but this sounds pretty ugly.</p>
  
  <p>It is also working when I tell Eclipse to "clean" my project. Then the compile goal target is called. So the functionality is all there I just want to have it executed when I save a JavaScript file. This must be possible somehow, or not?</p>
  
  <p>Any hints?</p>