【问题标题】:Using The Assembly Plugin for Maven and remove the assembly descriptor id from the file name使用 Maven 的程序集插件并从文件名中删除程序集描述符 id
【发布时间】:2020-12-26 21:59:44
【问题描述】:

我正在使用 maven 插件

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>assembly.xml</descriptor>
                    </descriptors>
                    <finalName>calzada-${pom.version}</finalName>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

这是我的 assembly.xml

<assembly
        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
    <id>id</id>
    <formats>
        <format>zip</format>
    </formats>

但是当我压缩文件时,-id 会添加到名称文件的末尾

【问题讨论】:

    标签: maven zip maven-2 maven-3 maven-assembly-plugin


    【解决方案1】:

    你需要设置appendAssemblyId:

    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <configuration>
                        <descriptors>
                            <descriptor>assembly.xml</descriptor>
                        </descriptors>
                        <finalName>calzada-${pom.version}</finalName>
                        <appendAssemblyId>false</appendAssemblyId> 
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-04
      • 1970-01-01
      • 2010-12-19
      • 2015-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多