maven jetty pom.xml配置

来源:互联网 发布:mac系统万兆网络 编辑:程序博客网 时间:2024/05/17 12:47
Java Web项目中pom.xml文件初始创建Jetty运行环境


1. pom.xml文件编码设置


<?xml version="1.0" encoding="UTF-8"?>


2. 属性设置


 <properties>
        <!-- 通用属性 -->
        <java.version>1.6</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
 
      <!-- Jetty 属性, 保证Java web运行环境-->      
      <jetty.version>8.1.9.v20130131</jetty.version>
 </properties>


3. 依赖设置


<dependencies>
                <!-- jetty -->
        <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>
</dependencies>


4.  运行插件设置


<build>
        <plugins>
            <!-- jetty插件, 设定context path与spring profile -->
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <systemProperties>
                        <systemProperty>
                            <name>spring.profiles.active</name>
                            <value>development</value>
                        </systemProperty>
                    </systemProperties>
                    <useTestClasspath>true</useTestClasspath>
                    <webAppConfig>
                        <contextPath>/${project.artifactId}</contextPath>
                    </webAppConfig>
                </configuration>
            </plugin>
        </plugins>
</build>


本篇文章来源于 Linux公社网站(www.linuxidc.com)  原文链接:http://www.linuxidc.com/Linux/2014-10/108428.htm
0 0