springboot 打包成jar

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包的路径)

 

posted @ 2019-02-22 15:36  学海无涯皆比邻  阅读(203)  评论(0编辑  收藏  举报