maven jetty 启动正常,运行却一直报404

jetty插件配置如下

    <!-- -jetty插件 -->
                <!-- 添加此插件以便启动jetty -->  
                <plugin>
                  <groupId>org.eclipse.jetty</groupId>
                  <artifactId>jetty-maven-plugin</artifactId>
                  <version>9.2.8.v20150217</version>
                  <configuration>
                    <httpConnector>
                      <port>8081</port>
                    </httpConnector>
                    <stopKey>shutdown</stopKey>
                    <stopPort>9966</stopPort>
                   
                    <scanIntervalSeconds>2</scanIntervalSeconds>
                    
                    
                    <reload>manual</reload>
                    <dumpOnStart>true</dumpOnStart>
                  
                    <webApp>
                      <!--<contextPath>/${project.artifactId}</contextPath> -->
                      <contextPath>/</contextPath>
                          <defaultsDescriptor>src/main/conf/webdefault.xml</defaultsDescriptor>
                    </webApp>
                
              
                    <requestLog implementation="org.eclipse.jetty.server.NCSARequestLog">
                      <filename>target/access-yyyy_mm_dd.log</filename>
                      <filenameDateFormat>yyyy_MM_dd</filenameDateFormat>
                      <logDateFormat>yyyy-MM-dd HH:mm:ss</logDateFormat>
                      <logTimeZone>GMT+8:00</logTimeZone>
                      <append>true</append>
                      <logServer>true</logServer>
                      <retainDays>120</retainDays>
                      <logCookies>true</logCookies>
                    </requestLog>
                  </configuration>
                </plugin>

或者

打印日志

[INFO] webAppSourceDirectory E:\gls\GLS-APP\GlsAPI\src\main\webapp does not exist. Trying E:\gls\GLS-APP\GlsAPI\target\webapp-tmp


原来jetty插件配置webAppSourceDirectory默认是\src\main\webapp,而我项目静态资源路径是webroot/

加上配置  <webAppSourceDirectory>webroot/</webAppSourceDirectory>,成功


  • 8
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值