首页 > 代码库 > Maven Jetty Plugin

Maven Jetty Plugin

热部署maven项目代码

 

pom.xml

     <plugin>                <groupId>org.eclipse.jetty</groupId>                <artifactId>jetty-maven-plugin</artifactId>                <version>${jetty.plugin.version}</version>                <configuration>                    <scanIntervalSeconds>10</scanIntervalSeconds>                    <scanTargets>                        <!-- Working better with compiling specific java class -->                        <scanTarget>src/main</scanTarget>                        <scanTarget>pom.xml</scanTarget>                    </scanTargets>                    <httpConnector>                        <port>${jetty.http.port}</port>                    </httpConnector>                </configuration>            </plugin>

 

运行mvn jetty:run后,如果修改了代码,可以使用mvn compile或IDE右键compile 编译新的代码,然后就可以自动热部署了

 

参考:

https://www.eclipse.org/jetty/documentation/9.3.x/jetty-maven-plugin.html

http://stackoverflow.com/questions/6719406/jetty-autorefresh-autoload-for-quick-testing

Maven Jetty Plugin