当前位置: 代码迷 >> 综合 >> jetty 7 maven plugin配置
  详细解决方案

jetty 7 maven plugin配置

热度:26   发布时间:2023-12-06 04:03:09.0

jetty版本升级到7了,jetty 7 的maven plugin的配置较6发生了一些变化,如下:

 

 

1. pom配置

 

    maven-jetty-plugin改成jetty-maven-plugin

    connector implementation改成org.eclipse.jetty.server.nio.SelectChannelConnector

    contextPath改到webAppConfig节点下

 

   <plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>       
    <configuration>
     <webDefaultXml>
      src/main/resources/webdefault.xml
     </webDefaultXml>
     <webAppConfig>
      <contextPath>/</contextPath>
     </webAppConfig>
     <scanIntervalSeconds>0</scanIntervalSeconds>
     <connectors>
      <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
       <port>80</port>
       <maxIdleTime>60000</maxIdleTime>
      </connector>
     </connectors>                    
    </configuration>
   </plugin>

 

2.jetty-evn.xml修改

 

   WebAppContext改成org.eclipse.jetty.webapp.WebAppContext

   Resource改成org.eclipse.jetty.plus.jndi.Resource


<Configure class="org.eclipse.jetty.webapp.WebAppContext">

  <New id="postgresDb" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg>jdbc/postgres</Arg>
    <Arg>
     <New class="org.postgresql.ds.PGPoolingDataSource">  
   <Set name="serverName">db.gohouse.cn</Set>  
   <Set name="databaseName">gehouse</Set>
   <Set name="user">user</Set>
   <Set name="password">pass</Set>
  </New> 
    </Arg>
 </New>

</Configure>

  相关解决方案