在pom中使用maven程序集插件将Zip文件清空
我的pom.xml,但我写了如下内容在pom中使用maven程序集插件将Zip文件清空,maven,maven-assembly-plugin,Maven,Maven Assembly Plugin,我的pom.xml,但我写了如下内容 ....... .......... <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.5.3</version> <configuration> <finalName>${proj
.......
..........
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<finalName>${project.artifactId}</finalName>
<descriptor>assembly.xml</descriptor>
</configuration>
<executions>
<execution>
<id>create-archive</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
..........
.......
。。。。。。。
..........
maven汇编插件
2.5.3
${project.artifactId}
assembly.xml
创建存档
包裹
单一的
..........
.......
我的assembly.xml是
<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>${project.version}</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}/${create.stage.directory}</directory>
<includes>
<include>*.*</include>
</includes>
<outputDirectory>${project.basedir}/${create.release.directory}</outputDirectory>
</fileSet>
</fileSets>
</assembly>
${project.version}
假的
拉链
${project.basedir}/${create.stage.directory}
*.*
${project.basedir}/${create.release.directory}
这将在目标中创建一个空foldername.zip!!不在我给定的输出文件夹位置。它总是目标吗?我能超越吗??
但在给定的目录路径中,我有3个文件夹(其中包含一些文件)和readme.txt。我只是尝试在include标记中提供*.txt,但仍然得到了空的zip文件夹。我最初猜测我的目录路径和输出目录路径可能是错误的。我直接硬编码仍然没有运气
请提供帮助(这个问题不是重复的,而是类似的,我已经尝试了几乎所有与此相关的stackoverflow问题。他们没有解决任何问题)有关详细信息,请参阅
您的描述符现在的配置如下:
- 创建一个名为
${project.artifactId}
- 从目录
中,将所有具有扩展名的文件(不是目录,因为它说${project.basedir}/${create.stage.directory}
,而不是像*.
文件夹中的${project.basedir}/${create.release.directory}
***/*.
不希望在目标中创建zip文件?在插件配置中设置,而不是在程序集描述符中设置。您希望实现什么?什么是
${create.stage.directory}
containing?是否要创建项目的源程序包?您好,谢谢您的帮助。我已经在您的帮助下解决了空zip问题。1)但outputDIrectory问题仍然存在。它始终位于目标目录中,因为它的默认值为${project.build.directory}.正如您所看到的,我给出了不同的值,但仍然无法覆盖。2) 另一个问题是我想压缩a/b/c中的内容,但在压缩c内容并打开zip文件夹后,我看到了a/b/x结构,但我只想要c中的内容:(:”(对不起,上面的第1点也解决了。我打错了。但是我如何才能只得到c而不是a\b\c结构呢?将文件集的目录更改为${project.basedir}/${create.stage.directory}/a/b
嗨,谢谢。我也有同样的东西。所以在它用${project.basedir}/${create.stage.directory}创建的输出zip中/a/b/c但我想在c.${project.basedir}/${create.stage.directory}内部的是project/a/b/c,我需要将c内部的内容压缩到我给出的文件名中