POM文件编译打包配置整理

本文详细介绍了如何使用Maven插件进行项目打包,包括指定testng.xml路径的编译配置,以及springboot项目的编译打包过程,涵盖pom依赖管理和应用程序入口设置。

1、整个打包过程就是插件添加过程,添加build插件

2、指定testng.xml路径的编译插件:执行mvn clean package

<build>
        <finalName>test</finalName>
        <plugins>
            <!--编译打包配置-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.7.1</version>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>
                            <!--配置testng.xml路径-->
                            ./src/main/resources/testng.xml
                        </suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>
        </plugins>
    </build>
View Code

3、springboot项目编译打包,包括对应pom依赖

<!--springboot项目编译打包-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <!--指定应用程序入口-->
                    <mainClass>extentreport.TestMethodsDemo</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                    <compilerArguments>
                        <extdirs>${project.basedir}</extdirs>
                    </compilerArguments>
                </configuration>
            </plugin>
View Code

 

转载于:https://www.cnblogs.com/wangkc/p/10853092.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值