Issue Details (XML | Word | Printable)

Key: JETTY-346
Type: Improvement Improvement
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Jan Bartel
Reporter: Matt Raible
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Jetty

Add wildcard support to <scanTarget> of maven-jetty-plugin

Created: 23/May/07 12:45 AM   Updated: 30/Aug/07 02:27 AM
Component/s: Maven2
Affects Version/s: 6.0.0
Fix Version/s: None

Time Tracking:
Not Specified


 Description  « Hide
It'd be great if wildcard support could be added to the <scanTarget> configuration element. That way, configuration could be changed from:

<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.0</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>3</scanIntervalSeconds>
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF/applicationContext.xml</scanTarget>
<scanTarget>src/main/webapp/WEB-INF/menu-config.xml</scanTarget>
<scanTarget>src/main/webapp/WEB-INF/urlrewrite.xml</scanTarget>
<scanTarget>src/main/webapp/WEB-INF/web.xml</scanTarget>
</scanTargets>
</configuration>
</plugin>

To:

<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.0.0</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>3</scanIntervalSeconds>
<scanTargets>
<scanTarget>src/main/webapp/WEB-INF/*.xml</scanTarget>
</scanTargets>
</configuration>
</plugin>



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Jan Bartel added a comment - 31/May/07 04:17 AM
In svn head rev 1888.

The solution is a little bit more verbose than your example, however it is in keeping with the style of other file lists in the pom, plus it gives the power of doing exclusions as well.

An example would look like:

<scanTargetPatterns>
<scanTargetPattern>
<directory>src/main/java</directory>
<includes>
<include>*/.properties</include>
<include>*/.xml</include>
</includes>
<excludes>
<exclude>**/particular.properties</exclude>
</excludes>
</scanTargetPattern>
</scanTargetPatterns>

This mechanism works alongside the existing <scanTargets> parameter.


Matt Raible added a comment - 29/Aug/07 12:16 PM
If I want to monitor *.xml and *.properties in webapp/WEB-INF and src/main/resources - do I have to specify anything or do I need something like the following:

<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>3</scanIntervalSeconds>
<scanTargetPatterns>
<scanTargetPattern>
<directory>src/main/resources</directory>
<includes>
<include>*/.properties</include>
<include>*/.xml</include>
</includes>
</scanTargetPattern>
<scanTargetPattern>
<directory>src/main/webapp/WEB-INF</directory>
<includes>
<include>*/.properties</include>
<include>*/.xml</include>
</includes>
</scanTargetPattern>
</scanTargetPatterns>
</configuration>

Thanks,

Matt


Jan Bartel added a comment - 30/Aug/07 01:36 AM
Hi Matt,

Here's the info on what files are scanned automatically by the plugin:
http://docs.codehaus.org/display/JETTY/Which+files+are+scanned+by+the+Jetty+Maven+Plugin

So if your *.xml and *.properties files from src/main/resources get built and put into target/classes (as is normal) then you don't have to do anything special for them.

On the other hand, only very specific files in WEB-INF are scanned, so if you want others then you'll have to add them as a scanTargetPattern, just as you've shown above.

cheers
Jan


Matt Raible added a comment - 30/Aug/07 02:07 AM
If I setup a scanTargetPattern for /src/main/resources (*.xml and *.properties), will it be scanned and re-deployed when using jetty:run-war?

Jan Bartel added a comment - 30/Aug/07 02:27 AM
Matt,

Currently neither the jetty:run-war nor jetty:run-exploded targets support the scanTarget or scanTargetPattern configuration properties. In the case of jetty:run-war, the redeployment only re-occurs the war file changes (ie you've done a mvn package in some other window). For jetty:run-exploded, it redeploys if any of a certain set of files it looks for inside the exploded war file changes (again, you've done a mvn package).

I can see that perhaps there's an argument for instrumenting the scanTarget stuff for run-exploded, but I'm not so sure about run:war.

cheers
Jan