Spring Boot Maven打包去掉不需要的文件

编程知识 更新时间:2023-04-05 04:44:32

Spring Boot Maven打包去掉不需要的资源文件。

如果使用Spring Boot去掉不需要的文件,使用这个配置好像没有作用:

 

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>resouces</exclude>
          <exclude>templates</exclude>
        </excludes>
      </resource>
    </resources>

换一种方式:

 

 

    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>1.3.3.RELEASE</version>
        <configuration>
          <mainClass>com.sspinfo.controller.WebApplication</mainClass>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-jar-plugin</artifactId>
		<version>2.4</version>
		<configuration>
			<excludes>
				<exclude>**/resources/**</exclude>
				<exclude>**/templates/**</exclude>
				<exclude>**/com/test/**</exclude>
			</excludes>
		</configuration>
	  </plugin>
    </plugins>

相当于两步打包操作,先去掉资源文件再使用Spring Boot Maven打包。

 

 

更多推荐

Spring Boot Maven打包去掉不需要的文件

本文发布于:2023-04-05 04:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/1c9f1db9e0192da4cb6520087227be13.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不需要   文件   Spring   Boot   Maven

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!

  • 44839文章数
  • 14阅读数
  • 0评论数