jetty的初探索

jetty9.4.17版本自定义项目名称以及运行端口的配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<build>
<!-- 打包之后的文件名称 -->
<finalName>cloud</finalName>
<plugins>
<!-- jetty插件 -->
<plugin>

<!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-maven-plugin -->
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.17.v20190418</version>

<configuration>

<webAppSourceDirectory>src/main/webapp</webAppSourceDirectory>

<!-- 这种方式已经不适用,低版本或许可以 -->
<!-- <contextPath>/cloud</contextPath> -->
<!-- <connectors> <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8080</port> </connector> </connectors> -->

<!-- http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#configuring-your-webapp -->
<scanIntervalSeconds>10</scanIntervalSeconds>
<webApp>
<contextPath>/cloud</contextPath>
</webApp>

<httpConnector>
<port>8888</port>
</httpConnector>

</configuration>
</plugin>
</plugins>

<!-- 打包jar -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

直接选择run as –> maven build 输入jetty:run 就能直接愉快的玩耍了啦!

谢谢,爱你么么哒