2

我正在使用程序集插件将我的 Swing 应用程序与 artifactId killer-app 和自定义程序集描述符打包在一起。

该程序集工作正常,我可以/killer-app/在程序集内的目录中包含我想要的任何内容。

killer-app-archive.zip
 \- killer-app
    \- whatever ...

问题是我必须/killer-app/在存档内的文件夹的同一级别包含另一个文件。

killer-app-archive.zip
 \- killer-app
 |  \- whatever ...
 \- launch.bat

我一直在尝试玩

<includeBaseDirectory>false</includeBaseDirectory>

但这只是删除了/killer-app/我必须保留的文件夹。

4

1 回答 1

9

三个步骤可以解决您的问题:

  • 更改baseDirectory../
  • 使用FileSets添加额外的文件。
  • 使用DependencySet添加项目工件(useProjectArtifact = true)

这应该可以解决您的问题。这是一个例子:

<?xml version="1.0" encoding="UTF-8"?>
<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>my-assembly</id>
    <baseDirectory>../</baseDirectory>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <dependencySets>
        <dependencySet>
            <unpack>true</unpack>
            <useProjectArtifact>true</useProjectArtifact>
        </dependencySet>
    </dependencySets>
    <fileSets>
        <fileSet>
            <directory>path/to/resource</directory>
            <includes>
                <include>**/*.bat</include>
            </includes>
            <outputDirectory>/</outputDirectory>
        </fileSet>
    </fileSets>
</assembly>
于 2013-01-13T09:59:22.183 回答