如何在IDEA中修改端口号和上下名的路径

首先先去Maven Repository中查找一个Jetty-maven-plugin在这里插入图片描述

    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>9.4.27.v20200227</version>

把他添加到 IntelliJ IDEA 的pom.xml文件中,注意插入的时候要在(plugins)(/plugins)中

<build>
    <finalName>Project24</finalName>
    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
      <plugins>

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

        </plugin>

然后在后面添加`

<!-- https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-maven-plugin -->
        <plugin>
          <groupId>org.eclipse.jetty</groupId>
          <artifactId>jetty-maven-plugin</artifactId>
          <version>9.4.27.v20200227</version>
          <configuration>
            <scanIntervalSeconds>10</scanIntervalSeconds>
            <httpConnector>
              <port>9090</port>  //修改后的端口号,默认是8080
            </httpConnector>
            <webApp>
              <contextPath>/Charles</contextPath>//修改后的上下名
            </webApp>
          </configuration>
        </plugin>

运行试一下效果

[INFO] --- jetty-maven-plugin:9.4.27.v20200227:run (default-cli) @ Project24 ---
[INFO] Logging initialized @3723ms to org.eclipse.jetty.util.log.Slf4jLog
[INFO] webAppSourceDirectory not set. Trying src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] nonBlocking:false
[INFO] Classes = D:\data\GitRepository\Project24\target\classes
[INFO] Configuring Jetty for project: Project24 Maven Webapp
[INFO] Context path = /Charles   //修改后的上下名
[INFO] Tmp directory = D:\data\GitRepository\Project24\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = file:///D:/data/GitRepository/Project24/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = D:\data\GitRepository\Project24\src\main\webapp
[INFO] jetty-9.4.27.v20200227; built: 2020-02-27T18:37:21.340Z; git: a304fd9f351f337e7c0e2a7c28878dd536149c6c; jvm 13.0.2+8
[INFO] Scanning elapsed time=46ms
[INFO] DefaultSessionIdManager workerName=node0
[INFO] No SessionScavenger set, using defaults
[INFO] node0 Scavenging every 660000ms
[INFO] Started o.e.j.m.p.JettyWebAppContext@619f2afc{Archetype Created Web Application,/Charles,file:///D:/data/GitRepository/Project24/src/main/webapp/,AVAILABLE}{file:///D:/data/GitRepository/Project24/src/main/webapp/}
[INFO] Started ServerConnector@31e739bf{HTTP/1.1, (http/1.1)}{0.0.0.0:9090}      //修改后的端口号
[INFO] Started @4425ms
[INFO] Started Jetty Server

在这里插入图片描述

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值