如何让maven jetty插件知道其他Web目录?

Fra*_*gan 6 javascript jetty maven

我想使用src/main/javascript作为我的javascript文件的源目录,同时仍然使用src/main/webapp来处理大多数其他web文件,但maven jetty:run plugin默认情况下不知道这个目录.

以下是到目前为止,但它似乎并没有让Jetty知道我的javascript目录:

<build>
  <plugins>
    <plugin>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>maven-jetty-plugin</artifactId>
      <version>6.1.12</version>
      <configuration>
        <webAppConfig>
          <contextPath>/${project.artifactId}</contextPath>
          <extraClasspath>target/classes/:src/main/javascript</extraClasspath>
        </webAppConfig> 
        <webResources>
          <resource>
            <directory>src/main/webapp</directory>
            <directory>src/main/javascript</directory>
          </resource>
        </webResources>
      </configuration>
    </plugin>
Run Code Online (Sandbox Code Playgroud)

如何让maven jetty插件知道这个addtional web目录?

Chr*_*ite 6

看起来这可以帮助你:

所以我修改你的配置如下:

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>maven-jetty-plugin</artifactId>
  <version>6.1.12</version>
  <configuration>
    <webAppConfig>
      <contextPath>/${project.artifactId}</contextPath>
      <!-- Javascript files are not java class files, so you can skip this
      <extraClasspath>target/classes/:src/main/javascript</extraClasspath>
      -->
      <baseResource implementation="org.mortbay.resource.ResourceCollection">
        <resourcesAsCSV>src/main/webapp,src/main/javascript</resourcesAsCSV>
      </baseResource>
    </webAppConfig> 
  </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)