zoukankan      html  css  js  c++  java
  • 【maven】使用assembly将maven项目打包

    1. 添加maven插件assembly

    <build>
            <plugins>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <descriptor>src/main/assembly/assembly.xml</descriptor>
                    </configuration>
                    <executions>
                        <execution>
                            <id>make-assembly</id> 
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>

    2. 在src/main/assembly路径下添加assembly.xml

    <assembly xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.0.0.xsd">
        <id>package</id>
        <formats>
            <format>tar.gz</format>
        </formats>
        <includeBaseDirectory>true</includeBaseDirectory>
        <fileSets>
            <fileSet>
                <directory>src/main/assembly/bin</directory>
                <outputDirectory>bin</outputDirectory>
            </fileSet>
            <fileSet>
                <directory>src/main/resources</directory>
                <outputDirectory>resources</outputDirectory>
            </fileSet>
        </fileSets>
        <dependencySets>
            <dependencySet>
                <outputDirectory>lib</outputDirectory>
                <scope>runtime</scope>
            </dependencySet>
        </dependencySets>
    </assembly>

    3. 运行mvn assembly:assembly

  • 相关阅读:
    链表
    线程池 ------ linux C实现
    thymeleaf 标签使用方法
    thymeleaf的配置
    exception processing, template error resolving template
    Thymeleaf模板表达式
    Mybatis:使用bean传值,当传入值为Null时,提示“无效的列类型”的解决办法
    windows 查看端口
    session与cookie的区别
    substr与substring的区别
  • 原文地址:https://www.cnblogs.com/inncho/p/5365551.html
Copyright © 2011-2022 走看看