Spring Boot packaged jar

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/weixin_45614509/article/details/102632153

The basic package

Usually it does not require any special settings must be executed only in the case maven package can then execute the command clean
Here Insert Picture Description

Skip unit tests

If the time to write unit tests in the project, then execute maven command to package the unit will perform the test again

        <plugins>
            <!-- 打包时跳过单元测试-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
        </plugins>

Reference external jar package

If you reference external jar package, the package when it will error, this time we can do this:

        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <scope>system</scope>
            <systemPath>${project.basedir}/lib/mssql-jdbc-6.4.0.jre8.jar</systemPath>
        </dependency>
        
        
        ...
        
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
            </plugin>

        </plugins>

Run jar

jara -jar xxxx.jar

Guess you like

Origin blog.csdn.net/weixin_45614509/article/details/102632153