Jetty Plugin - docBase Equivalent
-
06-07-2021 - |
题
I have a directory C:\documents\ and I would like its files and sub-directories to be accessible by visiting http://localhost/something/
? Using Tomcat, I know that I can use
<Context docBase="/documents" path="/somthing" />
How can this be done using the Maven Jetty Plugin? I'm using the plugin version as described below:
<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>
Thanks for your help.
解决方案
I was able to solve this problem by going to a later version of the plugin with making the following changes to my configuration (pom.xml) file:
<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>
不隶属于 StackOverflow