使用Maven管理Mybatis项目之pom文件配置

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>cc.ccoder</groupId>
    <artifactId>testRoler</artifactId>
    <version>1.0-SNAPSHOT</version>


    <!--基本的maven配置就完成了 现在添加使用Mybatis的基本配置-->
    <dependencies>
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.3.0</version>
        </dependency>

        <!--其他的基本配置,日志、单元测试、jdbc——jar包-->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.38</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.12</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.12</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

    </dependencies>

    <!--配置编译源代码的jdk版本-->
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**.*.xml</include>
                </includes>
            </resource>
        </resources>
    </build>

</project>

这里的配置是我创建一个空的Maven项目后添加的 ,但是如果你想创建Web项目的话还需要添加servlet-api、jstl等依赖jar包

聪聪的独立博客

聪聪的独立博客 ,一个喜欢技术,喜欢钻研的95后。


版权声明:本文为chencong3139原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。