Jetty
  1. Jetty
  2. JETTY-346

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

    Details

    • Type: Improvement Improvement
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.0.0
    • Fix Version/s: None
    • Component/s: Maven
    • Labels:
      None
    • Number of attachments :
      0

      Description

      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>

        Activity

        Hide
        Jan Bartel added a comment -

        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.

        Show
        Jan Bartel added a comment - 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.
        Hide
        Matt Raible added a comment -

        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

        Show
        Matt Raible added a comment - 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
        Hide
        Jan Bartel added a comment -

        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

        Show
        Jan Bartel added a comment - 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
        Hide
        Matt Raible added a comment -

        If I setup a scanTargetPattern for /src/main/resources (*.xml and *.properties), will it be scanned and re-deployed when using jetty:run-war?

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

        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

        Show
        Jan Bartel added a comment - 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

          People

          • Assignee:
            Jan Bartel
            Reporter:
            Matt Raible
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: