1. 程式人生 > >eclipse maven 使用 jetty 外掛配置

eclipse maven 使用 jetty 外掛配置

在pom引入配置jetty

<build>
	<finalName>chapter2</finalName>
	<plugins>
		<plugin>
			<groupId>org.eclipse.jetty</groupId>
			<artifactId>jetty-maven-plugin</artifactId>
			<version>9.4.8.v20171121</version>
			<configuration>
				<httpConnector>
					<port>8080</port><!-- 埠-->
				</httpConnector>
				<webApp>
					<contextPath>/bbs</contextPath><!--網站名稱-->
				</webApp>
			</configuration>
		</plugin>
	</plugins>
</build>

點選執行按鈕的 run configurations

找到左側選單中maven build

右鍵new(或者雙擊)出一個配置介面

在介面專案中填寫Goals為 jetty:run,點選workspace按鈕,選擇要釋出的專案。點選run就運行了。

更詳盡的配置請參考官方http://www.eclipse.org/jetty/documentation/9.4.x/jetty-maven-plugin.html#jetty-run-goal