---
title: "maven jetty 插件的配置"
author: "blueram"
date: "2013-08-06T09:27:32Z"
tags: []
categories: ["编程语言"]
slug: "maven-jetty"
draft: false
lastmod: "2013-08-06T09:27:32Z"
id: 1920735
url: "https://blueram.iteye.com/blog/1920735"
---

maven jetty 插件的配置  jeety7和jeety9的配置有很大区别，看下面

```
<!-- jetty 7插件, 设定context path与spring profile
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <webAppConfig>
                        <connectorNames>
                            <connectorName>0.0.0.0:8080</connectorName>
                        </connectorNames>
                        <contextPath>/${project.artifactId}</contextPath>
                        <defaultsDescriptor>src/test/resources/webdefault.xml</defaultsDescriptor>
                    </webAppConfig>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                    <stopKey>foo</stopKey>
                    <stopPort>9999</stopPort>
                </configuration>
            </plugin>-->

            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <httpConnector>
                        <port>8080</port>
                    </httpConnector>
                    <webApp>
                        <contextPath>/${project.artifactId}</contextPath>
                        <defaultsDescriptor>src/test/resources/webdefault.xml</defaultsDescriptor>
                    </webApp>
                    <scanIntervalSeconds>0</scanIntervalSeconds>
                    <stopKey>foo</stopKey>
                    <stopPort>9999</stopPort>
                </configuration>
            </plugin>
```

依赖jar

```
 <!-- jetty 7
        <dependency>
            <groupId>org.eclipse.jetty.aggregate</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>${jetty.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-jsp</artifactId>
            <version>${jetty.version}</version>
            <scope>test</scope>
        </dependency>-->
        <!--jetty 9-->
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>9.0.4.v20130625</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-jsp</artifactId>
            <version>9.0.4.v20130625</version>
            <scope>test</scope>
        </dependency>
```