pom.xml配置

1:头部引用

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
</project>

2:添加数据源数据,并调用数据源的jar包

<!-- 添加数据源 -->

<repositories>
    <repository>
        <id>mvn-repo</id>
        <url>http://maven.nlpcn.org/</url>
    </repository>
</repositories>

<!-- 调用数据源的jar包 -->

<dependencies>
    <dependency>
        <groupId>org.ansj</groupId>
        <artifactId>ansj_seg</artifactId>
        <version>5.0.1</version>
    </dependency>
</dependencies>
View Code

3:设置Java的版本号

<build>
    <plugins>
        <!-- 设置Java的版本号 -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>
View Code

4:web.xml路径设置

<build>
    <plugins>
        <!-- web.xml路径设置 -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <webResources>
                    <resource>
                        <directory>webapp</directory>
                    </resource>
                </webResources>
            </configuration>
        </plugin>
    </plugins>
</build>
View Code

 5:指定属性

<properties>
  <junit.version>3.8.1</junit.version><!-- 指定junit的版本 -->
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <jdk.version>1.7</jdk.version>
</properties>

---------------------------------

一步一步学习,不断成长。

原文地址:https://www.cnblogs.com/qypx520/p/5846566.html