maven jetty pom.xml配置
阿新 • • 發佈:2019-01-26
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
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