4

我有一个配置为启动 Jetty 并从 ../client 加载静态的 Maven 应用程序。配置如下:

<plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>8.1.4.v20120524</version>
            <configuration>
                <scanIntervalSeconds>25</scanIntervalSeconds>
                <connectors>
                    <connector implementation="org.eclipse.jetty.server.bio.SocketConnector">
                        <port>9095</port>
                        <maxIdleTime>60000</maxIdleTime>
                    </connector>
                </connectors>
                <webAppSourceDirectory>../client/</webAppSourceDirectory>
                <webAppConfig>
                    <resourceBases>
                        <resourceBase>src/main/webapp</resourceBase>
                        <resourceBase>../client/</resourceBase>
                    </resourceBases>
                </webAppConfig>
            </configuration>
</plugin>

我要做的是仅将 webapp 移动到 /API 资源库下。更明确地说,我想要映射:

src/main/webapp      --->     /API
../client/           --->     /
4

1 回答 1

5

终于找到了正确的配置:

<webAppConfig>
    <contextPath>/API</contextPath>
</webAppConfig>
<contextHandlers>
    <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
        <contextPath>/</contextPath>
        <resourceBase>../client/</resourceBase>
    </contextHandler>
</contextHandlers>
于 2012-09-14T11:06:24.373 回答