0

我有一个目录 C:\documents\,我希望它的文件和子目录可以通过访问来访问http://localhost/something/?使用Tomcat,我知道我可以使用

<Context docBase="/documents" path="/somthing" />

如何使用 Maven Jetty 插件来做到这一点?我正在使用插件版本,如下所述:

<plugins>
    <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
    <configuration>
      <scanIntervalSeconds>1</scanIntervalSeconds>
      <webDefaultXml>src/test/resources/webdefault.xml</webDefaultXml>
      <stopPort>9966</stopPort>
      <stopKey>foo</stopKey>
    </configuration>
    <version>7.0.0pre1</version>
    </plugin>
</plugins>

谢谢你的帮助。

4

1 回答 1

0

通过对我的配置(pom.xml)文件进行以下更改,我能够通过转到更高版本的插件来解决这个问题:

<plugins>
    <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
    <configuration>
      <scanIntervalSeconds>1</scanIntervalSeconds>
      <webDefaultXml>src/test/resources/webdefault.xml</webDefaultXml>
      <stopPort>9966</stopPort>
      <stopKey>foo</stopKey>
      <contextHandlers>
        <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
          <contextPath>/documents</contextPath>
          <resourceBase>/something</resourceBase>
        </contextHandler>
      </contextHandlers>          
    </configuration>
    <version>8.1.5.v20120716</version>
    </plugin>
</plugins>
于 2012-10-11T16:04:53.243 回答