jetty启动,设置虚拟路径

 

原链接:maven pom 配置jetty启动,设置虚拟路径

 

 

参考配置如下:

 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

        ......

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jdk.version>1.8</jdk.version>
        <maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
    </properties>
    <dependencies>
        ......
    </dependencies>
    <build>
        <finalName>test_pro</finalName>
        <plugins>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.2.10.v20150310</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <httpConnector>
                        <port>8080</port>
                    </httpConnector>
                    <webApp>
                        <contextPath>/test_pro</contextPath>
                    </webApp>
                    <contextHandlers>
                        <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
                            <!--设置虚拟路径  -->
                            <contextPath>/test_pro/upload</contextPath>
                            <resourceBase>G:/upload_dir/upload</resourceBase>
                        </contextHandler>
                    </contextHandlers>
                </configuration>
            </plugin>

            <!-- 集成JDK编译插件compiler, 设定编译时用的JDK版本 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${jdk.version}</source>
                    <target>${jdk.version}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>

        </plugins>
    </build>


</project>

 

 

 

码连 微信公众平台 : “码连”(ID:maliantech) 欢迎关注~

 

posted @ 2018-04-20 15:50  不会摇头的风扇  阅读(1625)  评论(0编辑  收藏  举报