1. 程式人生 > >springboot 打包成jar

springboot 打包成jar

sed pom fig -c lean play targe aps sna

1.pom.xml配置

技術分享圖片
<build>
        <plugins>
            <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> <maimClass>com.lxp.Application</maimClass> </configuration> <executions> <execution> <goals> <goal>
repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <!-- 使用aliyun鏡像 --> <repositories> <repository> <id>aliyun</id> <name>aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </repository> </repositories>
View Code

2、Run As-->Maven build-->clean package

技術分享圖片

3、將target下的xx.jar包復制出來,方便cmd啟動項目

技術分享圖片

4、打開cmd執行命令:java -jar F:\cppdy\SpringBoot-0.0.1-SNAPSHOT.jar(jar包的路徑)

技術分享圖片

springboot 打包成jar