Erik Mitchell
Erik Mitchell

Reputation: 425

Execute "generate-resources" build phase when Jetty restarts?

I'm using the jetty-maven-plugin to act as a local server for my web app. During the "generate-resources" phase of my build, I execute lessc and grunt to compile my CSS and JavaScript respectively.

I'd like to use Jetty's "scanIntervalSeconds" and "scanTargetPattern" configurations to watch my .less and .js files, and run my build when I make changes to those files.

I have that part set up, and Jetty restarts when I make changes to those files, however the restart does not execute the "generate-resources" phase of my build (I'm not sure if it executes any part of my build at all).

Is there a way to specify what should happen when Jetty restarts?

Upvotes: 3

Views: 258

Answers (2)

Kai Moritz
Kai Moritz

Reputation: 621

If you are looking for a solution to see changes to your LESS-code on page-reload, while developing with jetty-maven-plugin, but precompile your LESS-code for maximum page-speed when building the WAR-file, you might be intrested in this article I wrote: http://juplo.de/combining-jetty-maven-plugin-and-wro4j-maven-plugin-for-dynamic-reloading-of-less-resources/

Upvotes: 0

Joakim Erdfelt
Joakim Erdfelt

Reputation: 49462

Maven controls the "generate-resources" phase of your build.

Jetty's internal webapp hot deployment controls the redeploy.

There is no facility to interact between the two. And adding that facility to Jetty would require Jetty itself to embed maven itself, a non-trivial task.

Upvotes: 1

Related Questions