Reputation: 21991
I've been struggling to get Jetty to run with maven filtering. The jetty:run uses the maven source directory so doesn't see the filtered file. jetty:run-exploded works fine but I can't update my webpages in realtime.
Surely there must be a way of using maven filtering and not having rerun the jetty task everytime I change a webpage?
(Is there a way to get eclipse to automatically copy the webpages to the target directory? I thought it would do this by default but it doesn't seem to work. I used to use an eclipse builder with a trigger and ant task but this seems a bit old fashioned.)
Upvotes: 1
Views: 721
Reputation: 5570
I had almost same issue. I have solved my problem changing paths for jetty plugin. What I have done is simply
Changing the paths for jetty plugin to configure
<profile>
<id>jetty</id>
<build>
<resources>
<resource>
<directory>../../conf/jetty</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-version}</version>
..
<configuration>
<jettyConfig>${project.build.outputDirectory}/jetty.xml</jettyConfig>
<webAppConfig>
<contextPath>/${jettyContextName}</contextPath>
..
<jettyEnvXml>${project.build.outputDirectory}/jetty-env-${jetty-env}.xml</jettyEnvXml>
</webAppConfig>
<stopKey/>
<stopPort/>
</configuration>
</plugin>
</plugins>
</build>
</profile>
If you share your configuration we can assist for further modifications. But basically what you want to do is not easy task and dangerous because of changing the files inplace.
There could be another suggestion too. Despite of not recommending this way, You might run war:inplace before jetty:run like this.
mvn war:inplace jetty:run
However I havent tried this solution and I suggest you to stay away from this way.
Upvotes: 1