码迷,mamicode.com
首页 > 编程语言 > 详细

打包Spring Boot工程

时间:2019-02-03 14:11:00      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:plugins   pac   nap   pack   pom   intel   配置   ref   following   

在intellij idea 中,需要在maven中 新建 Run configuration,对应的command-line 为 :clean install spring-boot:repackage
 
Pom.xml代码  技术图片
  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  2.     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  
  3.     <modelVersion>4.0.0</modelVersion>  
  4.     <groupId>liwei.test</groupId>  
  5.     <artifactId>spring-boot</artifactId>  
  6.     <version>0.0.1-SNAPSHOT</version>  
  7.     <packaging>jar</packaging>  
  8.     <properties>  
  9.         <java.version>1.7</java.version>  
  10.         <start-class>com.test.springboot.Startup</start-class>  
  11.     </properties>  
  12.     <!-- Inherit defaults from Spring Boot -->  
  13.     <parent>  
  14.         <groupId>org.springframework.boot</groupId>  
  15.         <artifactId>spring-boot-starter-parent</artifactId>  
  16.         <version>1.0.1.RELEASE</version>  
  17.     </parent>  
  18.   
  19.     <!-- Add typical dependencies for a web application -->  
  20.     <dependencies>  
  21.         <dependency>  
  22.             <groupId>org.springframework.boot</groupId>  
  23.             <artifactId>spring-boot-starter-web</artifactId>  
  24.         </dependency>  
  25.     </dependencies>  
  26.   
  27.     <build>  
  28.         <pluginManagement>  
  29.             <plugins>  
  30.                 <plugin>  
  31.                     <artifactId>maven-compiler-plugin</artifactId>  
  32.                     <configuration>  
  33.                         <source>1.7</source>  
  34.                         <target>1.7</target>  
  35.                     </configuration>  
  36.                 </plugin>  
  37.             </plugins>  
  38.         </pluginManagement>  
  39.     </build>  
  40.   
  41.     <repositories>  
  42.         <repository>  
  43.             <id>spring-snapshots</id>  
  44.             <url>http://repo.spring.io/snapshot</url>  
  45.             <snapshots>  
  46.                 <enabled>true</enabled>  
  47.             </snapshots>  
  48.         </repository>  
  49.         <repository>  
  50.             <id>spring-milestones</id>  
  51.             <url>http://repo.spring.io/milestone</url>  
  52.         </repository>  
  53.     </repositories>  
  54.     <pluginRepositories>  
  55.         <pluginRepository>  
  56.             <id>spring-snapshots</id>  
  57.             <url>http://repo.spring.io/snapshot</url>  
  58.         </pluginRepository>  
  59.         <pluginRepository>  
  60.             <id>spring-milestones</id>  
  61.             <url>http://repo.spring.io/milestone</url>  
  62.         </pluginRepository>  
  63.     </pluginRepositories>  
  64. </project>  

 

配置Maven Build-Run Configurations

Goals:org.apache.maven.plugins:maven-jar-plugin:2.4:jar org.springframework.boot:spring-boot-maven-plugin:1.0.1.RELEASE:repackage

必须选择先maven后spring-boot-maven

如果这个地方不配置的话,会出错:

Java代码  技术图片
  1. [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.0.1.RELEASE:repackage (default-cli) on project spring-boot: Execution default-cli of goal org.springframework.boot:spring-boot-maven-plugin:1.0.1.RELEASE:repackage failed: Source must refer to an existing file -> [Help 1]  
  2. [ERROR]   
  3. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.  
  4. [ERROR] Re-run Maven using the -X switch to enable full debug logging.  
  5. [ERROR]   
  6. [ERROR] For more information about the errors and possible solutions, please read the following articles:  
  7. [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException  

 

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

打包Spring Boot工程

标签:plugins   pac   nap   pack   pom   intel   配置   ref   following   

原文地址:https://www.cnblogs.com/skinchqqhah/p/10350251.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!