欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

maven

程序员文章站 2022-05-08 13:33:46
...

maven使用jetty启动

一. 配置

  Maven配置代码:

<!-- 添加此插件以便启动jetty -->  
<plugin>  
    <groupId>org.mortbay.jetty</groupId>  
    <artifactId>maven-jetty-plugin</artifactId>  
    <version>6.1.10</version>  
    <configuration>  
        <encoding>UTF-8</encoding>  
        <scanIntervalSeconds>10</scanIntervalSeconds>  
        <stopKey>foo</stopKey>  
        <stopPort>9999</stopPort>  
    </configuration>  
    <executions>  
        <execution>  
            <id>start-jetty</id>  
            <phase>pre-integration-test</phase>  
            <goals>  
                <goal>run</goal>  
            </goals>  
            <configuration>  
                <scanIntervalSeconds>0</scanIntervalSeconds>  
                <daemon>true</daemon>  
            </configuration>  
        </execution>  
        <execution>  
            <id>stop-jetty</id>  
            <phase>post-integration-test</phase>  
            <goals>  
                <goal>stop</goal>  
            </goals>  
        </execution>  
    </executions>  
</plugin> 

 

   简化版配置:

<plugin>  
    <groupId>org.mortbay.jetty</groupId>  
    <artifactId>jetty-maven-plugin</artifactId>  
    <version>8.1.5.v20120716</version>  
    <configuration>  
        <stopPort>9966</stopPort>  
        <stopKey>foo</stopKey>  
        <scanIntervalSeconds>10</scanIntervalSeconds>  
        <webApp>  
            <contextPath>/teff</contextPath>  
        </webApp>  
    </configuration>  
</plugin>  

 

 

二. maven启动命令

 

mvn -Djetty.port=9999 jetty:run

可以同时启动多个,而不至于端口冲突

 

 

 

安装本地Jar包到库

 

mvn install:install-file -Dfile=IKAnalyzer2012FF_u1.jar -DgroupId=org.wltea.ik-analyzer -DartifactId=ik-analyzer -Dversion=1.0.0 -Dpackaging=jar

 

相关标签: maven jetty