我在组装目标产品期间使用tycho-p2-repository-plugin
。其 archive-repository
目标的默认行为是创建聚合 p2 存储库的 zip 存档。
我想知道如何将父repository
目录包含在zip文件中?默认情况下,仅包含 repository
目录的内容。例如,如果您在 repository
目录中有 2 个文件 a.file
和 b.file
,那么当您打开生成的 jar 时,您'看到这个
a.file
b.file
但是,我想要的是 repository
目录本身成为 zip 中的第一层,如果深入研究它,您会看到其他层,如下所示:
repository/
-> a.file
-> b.file
如何让 tycho-p2-repository-plugin
来执行此操作?
最佳答案
据我所知,tycho-p2-repository-plugin 不允许自定义生成的 zip 文件的布局。
我们有一个类似的用例,我们必须从 p2 存储库的包中创建一个 WAR 文件,并因此使用 maven-assemble-plugin
。
这是我们在 pom.xml
中指定的内容:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
<finalName>my-repo</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>verify</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
这是 assembly.xml
的样子:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> <id>com.diwoblood.war</id>
<formats>
<format>war</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${basedir}/target/repository/</directory>
<outputDirectory>/repository</outputDirectory>
</fileSet>
</fileSets>
</assembly>
关于eclipse-rcp - 使用 tycho-p2-repository-plugin 创建带有父目录的 zip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29710472/