java - 自定义解压缩文件夹(maven-assembly-plugin)

标签 java maven maven-assembly-plugin

我已经在 inet 和 mvn 文档中搜索过,但找不到解决方案。

我正在使用 maven-assembly 插件来压缩我的应用程序。当我打包时,我收到这样的 zip 文件:

abc-uat.zip----> abc__                           
                        |_bin
                        |_properties
                        |_....

我的目标是:存档中不应出现“abc”文件夹。

abc-uat.zip---->                           
                    |_bin
                    |_properties
                    |_....

我的 Pom:

        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2.1</version>
            <executions>

                <execution>
                    <id>make-uat</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <descriptors>
                            <descriptor>${basedir}/environments/uat/assembly/assembly.xml</descriptor>
                        </descriptors>
                        <finalName>abc</finalName>
                        <appendAssemblyId>true</appendAssemblyId>
                        <workDirectory>${project.build.directory}/${project.artifactId}/work/abc-dev</workDirectory>
                        <outputDirectory>${project.build.directory}/${project.artifactId}/output</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>

我的程序集:

<id>uat</id>
<formats>
    <format>zip</format>
</formats> 

<fileSets>

    <fileSet>
        <directory>${basedir}/environments/uat</directory>
        <outputDirectory>/</outputDirectory>
        <includes>
            <include>/**/*.sh</include>
            <include>/**/*.properties</include>
        </includes>
    </fileSet> 

</fileSets> 

最佳答案

您必须将以下行添加到您的程序集描述符中,例如:

<includeBaseDirectory>false</includeBaseDirectory>

关于java - 自定义解压缩文件夹(maven-assembly-plugin),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20199353/

相关文章:

java - 在一段时间内从开关中退出,但没有 boolean 值,这可能吗? java

java - Maven 程序集依赖程序集?

java - 从 Eclipse 中调试 Maven 程序集

java - Android:HTML 编码器

java - 将节点添加到初始为空的链表

java - Mock Mule JavaComponent

java - 将 quartz 添加到项目会破坏 jdbc 数据源

java - 如何将 Maven (?) 坐标分配给我的 Gradle 项目?

java - Maven 依赖项 :go-offline command issue

java - 如何使使用 maven-assembly-plugin 生成的 WAR 存档可用于其​​他项目的单元测试?