I'm working with Eclipse and Maven and run my application using the Maven jetty plugin.
I find it mildly irritating that Maven insists on recompiling my files every time I execute jetty:run. It is sub-optimal, as the files have already been compiled by Eclipse (and I'm writing Scala which has a (relatively) slow compiler).
I'm using profiles, and run mvn jetty:run under my 'development' profile.
What I want to do is:
Configure the jetty plugin so that it skips the compilation phase whilst running under the development profile.
I've looked into maven lifecycle documentation but haven't found any information about a 'skip.compile' flag or configuration parameter.
I've also tried configuring Maven like so in the vain assumption that it would stop the recompile upon maven-jetty-plugin startup.
I was wrong, it did not work. But what I have thought is, perhaps the Scala compiler is the problem. Perhaps it ignores the compile stuff.
development maven-compiler-plugin default-testCompile test-compile default-compile compile 1.6 1.6 false org.mortbay.jetty jetty-maven-plugin 7.2.2.v20101205 true development
Update:
I'm going to try specifically disabling scala compilation
Using the Jetty Plugin enables you to quickly test your web application by skipping the last two steps. By default the Jetty Plugin scans target/classes for any changes in your Java sources and src/main/webapp for changes to your web sources.
The only way to stop the Jetty Server is by pressing Ctrl + C in the shell prompt. Actually, there is a way to issue a stop command to the Jetty Server on another shell prompt. But you have to specify the STOP. PORT and STOP.
Deploying by Copying WAR The easiest way to deploy a web application to Jetty server is probably by copying the WAR file into the $JETTY_HOME/webapps directory. Jetty will scan its $JETTY_HOME/webapps directory at startup for web applications to deploy. Our new app will be deployed at /jetty-app context.
Finally solved it.. @RobertMunteanu
Wow! Well I've finally figured out what I was doing wrong, the solution is to create a development and production profile, and, for the development profile configure the Scala plugin executions to do nothing.
Like so :
<profile>
<id>development</id>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<goals></goals>
<phase>compile</phase>
</execution>
<execution>
<id>test-compile</id>
<goals></goals>
<phase>test-compile</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals></goals>
</execution>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals></goals>
</execution>
<execution>
<phase>process-resources</phase>
<goals>
</goals>
</execution>
</executions>
</plugin>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With