如何使Maven程序集插件排除基本目录名称?

时间:2019-04-11 21:32:04

标签: java xml maven plugins

由于某种原因,基本目录被添加为我的zip文件中的根目录。我不希望将要添加到zip文件的文件放在任何根目录下。

我已经尝试从POM文件中删除fileName标记,但只是将其重命名为root-name-SNAPSHOT.zip

<assembly
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
    <id>prep-id</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
        <fileSet>
            <directory>target</directory>
            <outputDirectory></outputDirectory>
            <excludes>
                <exclude>maven-archiver/**</exclude>
                <exclude>*.jar</exclude>
                <exclude>archive-tmp/**</exclude>
                <exclude>classes/**</exclude>
                <exclude>generated-sources/**</exclude>
                <exclude>test-classes/**</exclude>
            </excludes>
        </fileSet>
        <fileSet>
            <directory>target/classes</directory>
            <outputDirectory></outputDirectory>
        </fileSet>
    </fileSets>
</assembly>
<build>
<finalName>root-name</finalName>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.5.5</version>
    <executions>
        <execution>
            <phase>package</phase>
            <id>assemble</id>
            <goals>
                <goal>single</goal>
            </goals>
            <configuration>
                <descriptors>
                    <descriptor>src/assembly/prep.xml</descriptor>
                </descriptors>
                <appendAssemblyId>false</appendAssemblyId>
            </configuration>
        </execution>
        <execution>
            <phase>package</phase>
            <id>bundle</id>
            <goals>
                <goal>single</goal>
            </goals>
            <configuration>
                <finalName>root-name-2.0</finalName>
                <descriptors>
                    <descriptor>src/assembly/bundle.xml</descriptor>
                </descriptors>
                <appendAssemblyId>false</appendAssemblyId>
            </configuration>
        </execution>
    </executions>
</plugin>
</build>

我想从我的zip文件中排除基本目录root-name。 其zip目录将成为根目录。 所以:

root-name.zip |  -lib  -com

而不是:

root-name.zip |  -root-name     |      -lib      -com

0 个答案:

没有答案