Maven pom.xml 必须包含
<Packaging> pot </packaging>
<Duild> <Glugins> <Glugin> <GroupId> org.springFramework.boot </prôdId> <Artifactid> Spring-Boot-Maven-Plugin </ ArfactId> <FIGIGRATION> <FORK> true </ Fork> </figioring> </gingin> </ / / plugins> </build>
完整 Pox.xml
<project xmlns = "http://maven.apache.org/pom/4.0.0" xmlns: xsi = "http://www.w3.org/2001/xmlschema-instance" xsi: schemalation = "http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd "> <ModelVersion> 4.0.0 </ ModelVersion> <proupId> com.feedback </rom grouped> <eartIDAD> Feedback-Service </RitifActid> <Dersion> 0.1.0 </package> <packaging> jar </packaging> <Java.version> 1.8 </java.version> </properties> <parent> <proupId> org.springframework.boot </prouverid> <lefactive> printemps-boot-starter-Parent </letefactive> <version> 1.3.0.release </-version> </parestration> <! - Spring Boot -> <dépendance> <GroupId> org.springframework.boot </proupId> <ArtifactId> printemps-boot-starter-web </ artifactid> </dendency> <dependency> <proupId> org.springframework.boot </prouprid> <Artifactid> printemps-boot-starter-data-jpa </ artifactid> </sendency> <Dependance> <ProupId> MySQL </rom grouped> <Artifactid> MySQL-Connector-Java </RetingId> </Dependency> <! - Commons-Lang -> <Dependance> <ProupId> Commons-Lang </prouved> <ArtifActid> Commons-Lang </ Artifactid> <Derson> 2.6 </Dersion> </Dependence> <flugins> <harin> <proupId> org.springframework.boot </prôdId> <ArtifActid> printemps-boot-maven-Plugin </ artifactId> <fonfi configuration> <fork> true </fork> </figfinource> </gingin> </glugins> </fuild> </prède>
进入到项目目录下运行 : mvn clean package
会在项目目录下 cible 文件夹中生成 pot
如上生成的 pot 文件在 : D: / programmeur / éclipse / service de rétroaction / cible 文件夹中
Java -jar 运行 Jar 包 即可
Java -jar 运行 Jar 包时使用外部配置文件 application.properties
总结
以上所述是小编给大家介绍的 Spring Boot Maven 打包可执行 Jar 文件的实现方法 , 希望对大家有所帮助 , 如果大家有任何疑问请给我留言 , 小编会及时回复大家的。在此也非常感谢大家对武林网网站的支持!