1

I have a situation where in I have to unzip some resources into the source jar during packaging. Here is the sample project structure:

SampleProject
  |__ src
  |__ resources
         |__ test1.jar [contains test1.xml, test1.*]
         |__ test2.jar [contains test2.xml, test2.*]

Expected output:

sampleProject-sources.jar
     |__ src
     |__ resources
           |__ test1
                |__test1.xml
                |__ test1.*
           |__ test2
                 |__test2.xml
                 |__test2.*

My pom.xml to generate sources:

<plugin>
 <groupId>${maven-groupid}</groupId>
  <artifactId>maven-source-plugin</artifactId>
  <version>${maven-version}</version>
 <configuration>
  <strictSrcIncludes>false</strictSrcIncludes>
 </configuration>
</plugin>

What additional configuration should be included into pom.xml

  • 1
    Did you check [this answer](http://stackoverflow.com/questions/3264064/unpack-zip-in-zip-with-maven) for some hints? – A_Di-Matteo Jan 18 '16 at 09:19
  • @A.DiMatteo is correct. I think you need to unzip the JARs into a temp directory and add it back with [`includes`](https://maven.apache.org/plugins/maven-source-plugin/jar-mojo.html#includes) – Tunaki Jan 18 '16 at 09:21
  • I can't test this right now but could you try this [pastebin](http://pastebin.com/HqjTWQpk)? (it does what my comment above is saying, I hope). – Tunaki Jan 18 '16 at 09:37
  • Why don't unpack those jar's and put them under version control their...From my point of view it does not make sense to use jar's there... – khmarbaise Jan 18 '16 at 12:31
  • @A.DiMatteo Thanks for the hints. I had checked this but wanted to know if there was a straight forward approach – Sandeesha M Jan 18 '16 at 13:35
  • @Tunaki Thanks for the inputs. I was able to achieve it by copying the jars to temp directory and add it back using additionalFileSets. – Sandeesha M Jan 18 '16 at 13:36

0 Answers0