Maven从生成的资源构建zip文件

时间:2015-09-29 12:28:55

标签: maven

如何从生成的资源构建zip文件?

尝试为目标下的所有生成文件生成zip文件。不确定问题出在哪里: 组件:

<id>resources-bundle</id>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
    <fileSet>
        <outputDirectory>${project.basedir}/</outputDirectory>
        <directory>${project.basedir}/</directory>
        <includes>
            <include>**/target/dependency/**.properties</include>
        </includes>
    </fileSet>
</fileSets>

pom entry:

<plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.5.2</version>
            <executions>
                <execution>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <phase>validate</phase>
                    <id>archive</id>
                    <configuration>
                        <appendAssemblyId>true</appendAssemblyId>
                        <formats>
                            <format>zip</format>
                        </formats>
                        <descriptors>
                            <descriptor>assembly.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>
            </executions>
        </plugin>

错误我面临:

Failed to create assembly: Error creating assembly archive test-libs: You must set at least one file.

非常感谢任何帮助!

由于

1 个答案:

答案 0 :(得分:0)

解决! assembly.xml ::

        <fileSet>
        <outputDirectory>resources/</outputDirectory>
        <directory>${project.basedir}/target/dependency/</directory>
        <includes>
            <include>**/**.properties</include>
        </includes>
    </fileSet>

的pom.xml:

<execution>
                    <id>pack-resources</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <appendAssemblyId>true</appendAssemblyId>
                        <formats>
                            <format>zip</format>
                        </formats>
                        <descriptors>
                            <descriptor>assembly.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>

由于