jetty starts, sets the virtual path

Original link: maven pom configure jetty to start, set virtual path


The reference configuration is as follows:

copy code
<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">
                            <!--Set virtual path-->
                            <contextPath>/test_pro/upload</contextPath>
                            <resourceBase>G:/upload_dir/upload</resourceBase>
                        </contextHandler>
                    </contextHandlers>
                </configuration>
            </plugin>

            <!-- Integrate the JDK compilation plugin compiler, set the JDK version used for compilation-->
            <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>
copy code

 

Meet Ghost Net  WeChat public platform: "Jian Ghost Net" (ID: faceghost) Welcome to pay attention~

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324602109&siteId=291194637