0

我有一个包含很多模块的大型 Maven 项目。其中一个模块不是“真正的”开发项目。它包含最终系统的数据。使用特殊的 jar 将数据部署到系统中。pom 现在确保下载了 jar,并将所有其他数据和批处理文件打包到一个 zip 中。它使用 Maven 程序集插件。这个 pom 文件没有什么神奇之处。当解压带有 Windows 压缩文件夹的 zip 文件时,魔法就开始了。它只会识别相当大的 jar 文件(9MB),而不识别批处理和数据文件(几 KB)。我没有立即注意到这一点,因为我真正的旧 Winzip 对工件没有任何问题。

有没有人有想法或见过类似的问题?


pom文件中的插件配置

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
        <descriptors>
            <descriptor>assembly.xml</descriptor>
        </descriptors>
    </configuration>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>

我的程序集 xml

<?xml version="1.0" encoding="UTF-8"?>
<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">

  <formats>
    <format>zip</format>
  </formats>  

  <dependencySets>
    <dependencySet>
      <outputDirectory></outputDirectory>
      <includes>
        <include>com.group:product-development-cli</include>
      </includes>
      <outputFileNameMapping>product-development-cli-${ext.version}.${extension}</outputFileNameMapping>
    </dependencySet>
  </dependencySets>

    <fileSets>
        <fileSet>
            <directory>.</directory>
            <excludes>
                <exclude>pom.xml</exclude>
        <exclude>assembly.xml</exclude>
        <exclude>target</exclude>
            </excludes>
        </fileSet>
    </fileSets>

</assembly>

我的文件夹结构: module +- data1 +- more files +- data2 +- more files +- pom.xml +- assembly.xml +- more files

4

2 回答 2

0

受 Edward Thomson 的启发,我再次查看了 zip 文件。zip 文件包含来自两个不同来源(文件集和依赖项)的文件。问题是文件集中的目录标签。( <directory>.</directory>) 压缩文件夹不喜欢 '.' 在路径的中间。

product-0.5.0-SNAPSHOT/./file.txt

当然,依赖是没有的.

于 2011-10-20T13:32:27.733 回答
0

您是否有可能超过 260 个字符的窗口路径长度限制?Windows 内置的压缩​​例程在它上面失败(即使其他 zip 程序可以处理它。)

由于 JAR 的层次结构,这似乎在处理 JAR 时经常出现。

您可以尝试解压缩到较短的路径(C:\A例如),看看是否有帮助?

于 2011-10-04T19:39:31.300 回答