在配置Context path 的地方,前提是你已经在pom.xml
配置好了maven-clean-plugin
如果不会配置可以参考小编上一篇来自小编上一篇的博客 。可以直接去Maven Reoisurory下载。
现在市面上常见的有org.eclipse.jetty
和 org.mortbay.jetty
两种 进入Maven Reoisurory
拷贝好代码代码就可以到pom.xml
配置了。
小编接下来会对这两种插件的配置进行一个详细的说明。
如果你使用的是org.mortbay.jetty
插件的那么在pom.xml配置信息如下:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.16.v20140903</version>
<configuration>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>8888</port>
</connector>
</connectors>
<webAppConfig>
<contextPath>/Web/Project</contextPath>
</webAppConfig>
</configuration>
</plugin>
如果你使用的是org.eclipse.jetty
插件,配置信息如下:
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.27.v20200227</version>
<configuration>
<httpConnector>
<port>8888</port>
<host>localhost</host>
</httpConnector>
<webAppConfig>
<contextPath>/web/Project/</contextPath>
</webAppConfig>
<scanIntervalSeconds>1</scanIntervalSeconds>
</configuration>
</plugin>
配置端口号:<port>8888</port>
配置端口号为8888。
配置路径:<contextPath>/Web/Project</contextPath>
在浏览器的路径就是为:http://locahost:8888/web/Project
。
⚠️⚠️浏览器输入的路径区分大小写。如果使用不同的jetty-maven-plugin
插件肯配置信息会有不同。
PS:小编的技术有限,如有问题可给小编私信哦。