首页  :: 新随笔  :: 管理

intellij idea使用配置jetty maven 插件

Posted on 2016-09-10 10:33  季枫  阅读(5696)  评论(0编辑  收藏  举报

pom.xml中更改或则添加:

    <build>
        <finalName>mall</finalName>
        <plugins>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>8.1.16.v20140903</version>
                <configuration>
                    <stopPort>9988</stopPort>
                    <stopKey>foo</stopKey>
                    <scanIntervalSeconds>5</scanIntervalSeconds>
                    <connectors>
                        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                            <port>8080</port>
                            <maxIdleTime>60000</maxIdleTime>
                        </connector>
                    </connectors>
                    <webAppConfig>
                        <contextPath>/</contextPath>
                    </webAppConfig>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.4.2</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <webResources>
                        <resource>
                            <!-- 元配置文件的目录,相对于pom.xml文件的路径 -->
                            <directory>src/main/webapp/WEB-INF</directory>
                            <!-- 是否过滤文件,也就是是否启动auto-config的功能 -->
                            <filtering>true</filtering>
                            <!-- 目标路径 -->
                            <targetPath>WEB-INF</targetPath>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
    </plugins>
    </build>

  第二步找到maven view:

第三步:debug运行

智读 | 成都会领科技有限公司官网 | 智读App下载 | 每天听本书的博客 | |