12

I followed the answer for how to create a ZIP archive in Maven here: https://stackoverflow.com/a/2514677/1395165 and have a couple of follow-up questions:

ZIP contents to exclude directory:

As in the example I have:

<fileSet>
    <directory>${project.basedir}/src/export</directory>
    <useDefaultExcludes>true</useDefaultExcludes>
</fileSet>

In the ZIP I get

src
  export
     Dir1
     Dir2

but I only want to have

Dir1
Dir2 

in the ZIP. Is that possible?

Output file name

The output file name is created with a .zip extension. Is it possible in Maven to override the extension to something else (say .abc)?

4

3 に答える 3

17

outputDirectoryオプションを使用して、ファイルが出力されるアセンブリ内のディレクトリを変更できます。これにより、必要な処理が実行されます。

<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<formats>
    <format>zip</format>
</formats>
<fileSets>
    <fileSet>
        <directory>${project.basedir}/ScriptedBuild/rConnect/extract/</directory>
        <useDefaultExcludes>true</useDefaultExcludes>
        <outputDirectory>/</outputDirectory>
    </fileSet>
</fileSets>
</assembly> 
于 2012-06-06T01:37:59.367 に答える
1

includeBaseDirectory を false に設定 - http://maven.apache.org/plugins/maven-assembly-plugin/assembly.htmlを参照

于 2012-05-15T05:14:14.960 に答える