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

  • 相关阅读:
    node分离路由文件
    node项目搭建步骤
    在express获取POST(类似表单请求)的数据
    10分钟搭建Kubernetes容器集群平台(kubeadm)
    今日考题
    jQuery方法介绍
    JQuery练习题
    今日面试题:
    bom操作,事件与jquery
    今日理解之js
  • 原文地址:https://www.cnblogs.com/inncho/p/5365551.html
Copyright © 2011-2022 走看看