【发布时间】:2010-12-02 19:31:14
【问题描述】:
致 Maven 大师: 我正在尝试将非 Java 项目工件 (.NET) 打包到单个 zip 文件中。我有两个问题:
如果我将 POM 中的包装更改为 zip <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. 好的,没什么大不了的 - 我将其更改为 <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 并执行 ant zip 任务?
【问题讨论】:
标签: maven-2 assemblies zip