java_code_mongrel
java_code_mongrel

Reputation: 41

Using tycho-p2-repository-plugin to create zip with parent directory

I am using the tycho-p2-repository-plugin during the assembly of my target product. The default behavior of its archive-repository goal is to create a zip archive of the aggregated p2 repository.

What I want to know is how to include the parent repository directory in the zip file? By default, only the contents of the repository directory are included. For example, if you have 2 files a.file and b.file in the repository directory, when you open the generated jar, you'd see this

a.file 
b.file

However, what I want is the repository directory itself to be the first layer in the zip, and if you drill down into it, you'd see the others, like this:

repository/
   -> a.file
   -> b.file

How can I get tycho-p2-repository-plugin to do this?

Upvotes: 2

Views: 725

Answers (1)

Rüdiger Herrmann
Rüdiger Herrmann

Reputation: 20985

AFAIK the tycho-p2-repository-plugin does not allow to customize the layout of the produced zip file.

We had a similar use case where we had to create a WAR file from the bundles of the p2 repository and used the maven-assembly-plugin therefore.

Here is what we specified in our 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>

And here is how the assembly.xml could look like:

<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>

Upvotes: 2

Related Questions