Jetty
  1. Jetty
  2. JETTY-680

Can't configure the ResourceCollection with maven

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.12rc1
    • Fix Version/s: 7.0.0pre4, 6.1.12.rc2
    • Component/s: Maven
    • Labels:
      None
    • Environment:
      Maven 2.0.9, JDK 1.6, Mac OS 10.5.4
    • Number of attachments :
      0

      Description

      I tried following the instructions <a href="http://docs.codehaus.org/display/JETTY/Multiple+WebApp+Source+Directory">Multiple WebApp Source Directory</a>, but maven is giving an error when trying to configure the ResourceCollection. It looks like maven is having problems with the overloaded setters. It is is trying to use ResourceCollection.setResources(Resource[]) instead of ResourceColection.setResources(String).

      $mvn jetty:run
      ...
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Failed to configure plugin parameters for: org.mortbay.jetty:maven-jetty-plugin:6.1.12rc1

      (found static expression: 'src/main/webapp,target/mlsdb' which may act as a default value).

      Cause: Cannot assign configuration entry 'resources' to 'class [Lorg.mortbay.resource.Resource;' from 'src/main/webapp,target/mlsdb', which is of type class java.lang.String

      pom.xml:
      ...
      <plugin>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>maven-jetty-plugin</artifactId>
      <configuration>
      <webAppConfig>
      <contextPath>/</contextPath>
      <baseResource implementation="org.mortbay.resource.ResourceCollection">
      <resources>src/main/webapp,target/mlsdb</resources>
      </baseResource>
      </webAppConfig>
      </configuration>
      </plugin>

      $ mvn -v
      Using Java version: 1.6
      Maven version: 2.0.9
      Java version: 1.6.0_05
      OS name: "mac os x" version: "10.5.4" arch: "x86_64" Family: "mac"

        Activity

        Hide
        David Yu added a comment -

        Thats interesting... It works for me on java 1.6.06 on windows xp.

        java version "1.6.0_06"
        Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
        Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)

        Show
        David Yu added a comment - Thats interesting... It works for me on java 1.6.06 on windows xp. java version "1.6.0_06" Java(TM) SE Runtime Environment (build 1.6.0_06-b02) Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)
        Hide
        David Yu added a comment -

        To avoid the maven overloading bug, use resourcesAsCSV instead.

        <baseResource implementation="org.mortbay.resource.ResourceCollection">
        <resourcesAsCSV>src/main/webapp,target/mlsdb</resourcesAsCSV>
        </baseResource>

        Cheers

        Show
        David Yu added a comment - To avoid the maven overloading bug, use resourcesAsCSV instead. <baseResource implementation="org.mortbay.resource.ResourceCollection"> <resourcesAsCSV>src/main/webapp,target/mlsdb</resourcesAsCSV> </baseResource> Cheers
        Hide
        Andrew Robinson added a comment -

        I can confirm this bug on Linux. Version info:

        mvn -v
        Maven version: 2.0.8
        Java version: 1.6.0_07
        OS name: "linux" version: "2.6.24-21-generic" arch: "i386" Family: "unix"

        Using resourcesAsCSV did work.

        This was using 6.1.12.rc2

        Show
        Andrew Robinson added a comment - I can confirm this bug on Linux. Version info: mvn -v Maven version: 2.0.8 Java version: 1.6.0_07 OS name: "linux" version: "2.6.24-21-generic" arch: "i386" Family: "unix" Using resourcesAsCSV did work. This was using 6.1.12.rc2
        Hide
        Gunther Verhemeldonck added a comment - - edited

        I had the same issues and was able to get it working, using 6.1.12.rc3 on Maven 2.2.1. However, if you specify a contextPath other than /, it will not work.

        If I enter a contextPath value as eg. "/test" and goto http://localhost:9081/, I can see that my additional source path is being recognized by Jetty, but somehow these resources are not servable.

        Working configuration:
        ----------------------

        <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.12.rc3</version>
        <configuration>
        <scanIntervalSeconds>10</scanIntervalSeconds>
        <webDefaultXml>src/dev/jetty/pb_webdefault.xml</webDefaultXml>
        <connectors>
        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
        <port>9081</port>
        <maxIdleTime>60000</maxIdleTime>
        </connector>
        </connectors>

        <!-- For Dojo integration -->
        <webAppConfig>
        <contextPath>/</contextPath>
        <baseResource implementation="org.mortbay.resource.ResourceCollection">
        <resourcesAsCSV>src/main/webapp,..\pb-dojo\dist\release</resourcesAsCSV>
        </baseResource>
        </webAppConfig>
        <!-- End Dojo integration -->

        <jettyEnvXml>$

        {basedir}

        /src/dev/jetty/jetty-env.xml</jettyEnvXml>
        </configuration>
        <dependencies>
        ...
        </dependencies>
        </plugin

        Show
        Gunther Verhemeldonck added a comment - - edited I had the same issues and was able to get it working, using 6.1.12.rc3 on Maven 2.2.1. However, if you specify a contextPath other than /, it will not work. If I enter a contextPath value as eg. "/test" and goto http://localhost:9081/ , I can see that my additional source path is being recognized by Jetty, but somehow these resources are not servable. Working configuration: ---------------------- <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.12.rc3</version> <configuration> <scanIntervalSeconds>10</scanIntervalSeconds> <webDefaultXml>src/dev/jetty/pb_webdefault.xml</webDefaultXml> <connectors> <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> <port>9081</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> <!-- For Dojo integration --> <webAppConfig> <contextPath>/</contextPath> <baseResource implementation="org.mortbay.resource.ResourceCollection"> <resourcesAsCSV>src/main/webapp,..\pb-dojo\dist\release</resourcesAsCSV> </baseResource> </webAppConfig> <!-- End Dojo integration --> <jettyEnvXml>$ {basedir} /src/dev/jetty/jetty-env.xml</jettyEnvXml> </configuration> <dependencies> ... </dependencies> </plugin
        Hide
        Samuel Robert added a comment -

        Using the Jetty maven plugin 6.1.26 with JDK1.7, I can still reproduce the bug in this environment:

        Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
        Java version: 1.7.0_21
        Java home: C:\Program Files\Java\jdk1.7.0_21\jre
        Default locale: de_DE, platform encoding: Cp1252
        OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows"

        [INFO] Failed to configure plugin parameters for: org.mortbay.jetty:maven-jetty-plugin:6.1.26
        (found static expression: 'src/main/webapp , C:\dev\workspaces\xxxx' which may act as a default value).
        Cause: Cannot assign configuration entry 'resources' to 'class [Lorg.mortbay.resource.Resource;' from 'src/main/webapp , C:\dev\workspaces\xxxx', which is of type class java.lang.String

        But when I

        • use "resourcesAsCSV" instead of "resources"
        • OR switch back to a JDK 1.6 (1.6.0_25)
          then I do not get the error anymore.
          So the workaround of "resourcesAsCSV" is enough for me.
        Show
        Samuel Robert added a comment - Using the Jetty maven plugin 6.1.26 with JDK1.7, I can still reproduce the bug in this environment: Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200) Java version: 1.7.0_21 Java home: C:\Program Files\Java\jdk1.7.0_21\jre Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 7" version: "6.1" arch: "x86" Family: "windows" [INFO] Failed to configure plugin parameters for: org.mortbay.jetty:maven-jetty-plugin:6.1.26 (found static expression: 'src/main/webapp , C:\dev\workspaces\xxxx' which may act as a default value). Cause: Cannot assign configuration entry 'resources' to 'class [Lorg.mortbay.resource.Resource;' from 'src/main/webapp , C:\dev\workspaces\xxxx', which is of type class java.lang.String But when I use "resourcesAsCSV" instead of "resources" OR switch back to a JDK 1.6 (1.6.0_25) then I do not get the error anymore. So the workaround of "resourcesAsCSV" is enough for me.

          People

          • Assignee:
            David Yu
            Reporter:
            John Hampton
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: