到Maven的专家那里: 我试图将非Java项目工件(.NET)打包到一个zip文件中。我有2个问题:Maven创建平坦的zip组件
如果我改变包装在我的POM拉上<packaging>zip</packaging>
,我得到这个错误信息:[INFO] Cannot find lifecycle mapping for packaging: 'zip'. Component descriptor cannot be found in the component repository: org.apache.mav en.lifecycle.mapping.LifecycleMappingzip.
OK,没什么大不了的 - 我把它改成<packaging>pom</packaging>
摆脱以其它方式产生无用的罐子在目标目录中
我的主要问题是我打包到ZIP中的文件嵌套在几个目录中,但我需要将它们放到ZIP的顶层目录中。这是我的汇编文件:
<assembly>
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${basedir}/${project.artifactId}</directory>
<includes>
<include>**/Bin/Release/*.dll</include>
<include>**/Bin/Release/*.pdb</include>
</includes>
</fileSet>
</fileSets>
</assembly>
当我运行这一点 - 我会得到ZIP文件,但文件将开始使用C嵌套:\后跟完整路径。为了让你的想法 - 项目转储它的二进制文件到以下结构 ProjectFoo\ProjectFoo\subproject1\Bin\Release\foo.dll
,我需要ZIP\foo.dll
这里的组件插件配置:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
也许我只需要使用antrun和执行蚂蚁拉链任务?
正是我需要的!谢谢Rich! – Bostone 2009-09-30 23:44:53
不用客气 – 2009-10-01 08:25:35
尽管如此,还是有一个问题。该zip仍然维护一个类型为“artifactId-Version”的顶级目录。当我提取zip文件时,所有的文件都不在'/'中,而是在'/ Foo-1.0-SNAPSHOT /'中。然而,这些文件被正确地复制到目标/ dll-staging – Bostone 2009-10-01 21:01:48