maven之jetty-maven-plugin插件

在各种学习体验和项目实战中,发现jetty比tomcat在开发方面更加的方便和好用,所以,下面就留下我的笔记,这个例子的代码还是接着上面的maven搭建的例子,jetty在maven中的使用方法如下:
步骤一:
在tian-parent中的插件管理中添加:

<plugin>
    <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>9.3.7.v20160115</version>
        <configuration>
            <webApp>
                <contextPath>/hello</contextPath>
            </webApp>
            <scanIntervalSeconds>10</scanIntervalSeconds>
            <stopPort>9899</stopPort>
            <stopKey>foo</stopKey>
            <stopWait>10</stopWait>
            <systemProperties>
                <systemProperty>
                    <name>tapestry.execution-mode</name>
                    <value>development</value>
                </systemProperty>
                <systemProperty>
                    <name>jetty.port</name>
                    <value>9090</value>
                </systemProperty>
            </systemProperties>
        </configuration>
        <executions>
            <execution>
                <id>start-jetty</id>
                <phase>pre-integration-test</phase>
                <goals>
                    <goal>run</goal>
                </goals>
                <configuration>
                    <daemon>true</daemon>
                </configuration>
            </execution>
            <execution>
                <id>stop-jetty</id>
                <phase>post-integration-test</phase>
                <goals>
                    <goal>stop</goal>
                </goals>
            </execution>
        </executions>
    </plugin>

步骤二:
在tian-web中的插件中加入:

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

在tian-web的pom.xml中运行clean package jetty:run就会在控制台看到jetty已经启动,
在浏览器中输入你配置的路径,比如本实例,我配置的是http://127.0.0.1:9090/hello/HelloServlet
就可以看到我的网页结果了,jetty可以配置一个检查更新的比如10s等,不用我们再去手动的打包编译等动作,这个就比tomcat的方便多了。

在我的配置过程中,也是出现了好多错误,真心感觉百度简直就是恶心人,大家想办法翻墙Google吧,花费了n天再次体会到技术的东西,百度跟谷歌的差距不是用时间就能解决的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值