maven常用插件

    <build>
        <plugins>

            <!-- tomcat7插件 -->
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <path>/</path>
                    <port>8080</port>
                    <uriEncoding>UTF-8</uriEncoding>
                </configuration>
            </plugin>

            <!--mvn生命周期的测试阶段的插件-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <!-- 是否跳过mvn test -->
                    <skipTests>true</skipTests>
                </configuration>
                <!--可以指定junit版本,dependencies不加就是默认的-->
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit4</artifactId>
                        <version>2.22.2</version>
                    </dependency>
                </dependencies>
            </plugin>

            <!-- 资源文件拷贝插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <!-- 基础文件拷贝,文件在依然在编译后的同级目录下 -->
            <resource>
                <directory>${basedir}/src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
                <filtering>false</filtering>
            </resource>
            <!-- 基础文件拷贝,文件在依然在编译后的同级目录下 -->
            <resource>
                <directory>${basedir}/src/main/resources</directory>
            </resource>

            <!--
            不同目录下的文件拷贝,以下是把mapperxml目录下的xml文件
            拷贝到编译后的dao目录下-->
            <resource>
                <!-- 不指定targetPath,默认编译后拷贝到同级目录下 -->
                <directory>${basedir}/src/main/resources/mapperxml</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
                <targetPath>dao</targetPath>
                <filtering>false</filtering>
            </resource>

        </resources>
    </build>
posted @ 2020-12-28 17:55  youngyajun  阅读(73)  评论(0编辑  收藏  举报