我正在使用maven-assembly-plugin来创建包含一些工件和其他东西的zip文件。其他内容位于名为“Installationattachments”的文件夹中。到目前为止一切正常。 “安装附件”还包含一个png和一个ico文件,这些文件也包含在内,但这些文件在包含后会被破坏。 这是我的pom.xml的插件声明:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/assembly/dep.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>create-archive</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<inherited>false</inherited>
</plugin>
这是装配本身的关键部分:
<!-- installation files -->
<fileSet>
<directory>Installationattachments</directory>
<outputDirectory></outputDirectory>
<lineEnding>unix</lineEnding>
<excludes>
<exclude>*.vbs</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>Installationattachments</directory>
<outputDirectory></outputDirectory>
<lineEnding>dos</lineEnding>
<includes>
<include>*.vbs</include>
</includes>
</fileSet>
答案 0 :(得分:1)
问题是通过<lineEnding>
参数指定行结尾。第一个文件集选择所有不是VBS文件的文件,因此它也选择PNG和ICO文件。但由于这些是二进制文件,因此您不希望为这些文件设置特定的行。
由于缺少nonFilteredFileExtensions
,在MASSEMBLY-849中询问了其支持,您可以添加第三个文件集而不会以图片的行结尾:
<fileSet>
<directory>Installationattachments</directory>
<outputDirectory></outputDirectory>
<lineEnding>unix</lineEnding>
<excludes>
<exclude>*.vbs</exclude>
<exclude>*.ico</exclude>
<exclude>*.png</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>Installationattachments</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*.ico</include>
<include>*.png</include>
</includes>
</fileSet>
<fileSet>
<directory>Installationattachments</directory>
<outputDirectory></outputDirectory>
<lineEnding>dos</lineEnding>
<includes>
<include>*.vbs</include>
</includes>
</fileSet>