Windows 压缩文件夹无法完全解压 zip
我有一个包含很多模块的大型 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>
我的文件夹结构: 模块 +- 数据1 +- 更多文件 +- 数据2 +- 更多文件 +- pom.xml +- 程序集.xml +- 更多文件
I have a big maven project with lots of modules. One of the modules is not 'real' development project. It contains data for the final system. The data is deployed to the system using a special jar. The pom now makes sure that the jar is downloaded and all the other data and batch files are packaged into a zip. It uses the maven assembly plugin. There is no much magic to this pom file. The magic starts when unpacking the zip file with Windows compressed folder. It will only recognize the jar file which is rather big (9MB) and not the batch and data files (a few KB). I didn't notice this right away because my really old Winzip does not have any issues with the artifact.
Does anybody has an idea or has seen similar issues?
the plugin configuration from pom file
<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>
My assembly 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>
My folder structure:
module
+- data1
+- more files
+- data2
+- more files
+- pom.xml
+- assembly.xml
+- more files
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否有可能超过 260 个字符的 Windows 路径长度限制? Windows 内置压缩例程对此失败(即使其他 zip 程序可以处理它)。
由于 JAR 的层次结构,在处理 JAR 时,这种情况似乎经常出现。
您可以尝试解压缩到较短的路径(例如
C:\A
)并看看是否有帮助?Any chance that you're exceeding the 260 character windows path length limit? The Windows built-in compression routines fail on it (even when other zip programs can deal with it.)
This seems to crop up frequently when dealing with JARs due to the hierarchical structure of JARs.
Could you try unzipping to a shorter path (
C:\A
for instance) and see if that helps?受到 Edward Thomson 的启发,我再次查看了该 zip 文件。该 zip 文件包含来自两个不同源(文件集和依赖项)的文件。问题是文件集中的目录标记。 (
.
) 压缩文件夹不喜欢“.”在路径的中间。product-0.5.0-SNAPSHOT/./file.txt
当然,依赖关系没有
.
。Inspired by Edward Thomson, I had another look at the zip file. The zip file contained files from two different sources (fileset and dependency). The issue was the directory tag in the fileSet. (
<directory>.</directory>
) Compressed Folders does not like '.' in the middle of the path.product-0.5.0-SNAPSHOT/./file.txt
The dependency was without the
.
of course.