maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Kettler <tim.kett...@udo.edu>
Subject Re: Unpacking jars into target/classes
Date Fri, 08 Mar 2013 08:44:10 GMT
Am 02.03.2013 21:32, schrieb Joachim Durchholz:
> Hi all,
>
> I have two jars from an external source and need to merge their contents
> into the target/classes tree until the process-classes phase.
> I'm not sure what plugin(s) can be used to achieve this effect.

As wholeheartedly as I agree to all what was said about Maven being 
opinionated (in a good way) and that one is best advised to stick to the 
conventions, there are cases where you just can't... and in my 
experience maven is quit good at handling these edge cases.

For the problem at hand, have a look at the truezip-m-p over at the 
codehaus mojo project, it should provide what you want:

   <properties>
     <mylib1.archive>${project.basedir}/libs/lib1.jar</mylib1.archive>
   </properties>

   <build>
     <plugins>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>truezip-maven-plugin</artifactId>
         <version>1.1</version>
         <executions>
           <execution>
             <id>copy-lib1-classes</id>
             <goals>
               <goal>copy</goal>
             </goals>
             <phase>process-classes</phase>
             <configuration>
               <fileset>
                 <directory>${mylib1.archive}</directory>
                 <includes>
                   <include>**/*</include>
                 </includes>
                 <excludes>
                   <exclude>META-INF/MANIFEST.MF</exclude>
                 </excludes>
 
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
               </fileset>
             </configuration>
           </execution>
         </executions>
       </plugin>
     </plugins>
   </build>

> Directory structure:
> - external (directory tree that holds the externally-provided files)
>    - libs
>      - cubes.jar (class files)
>      - cubes-resources.jar (nonclass files)
>    - license etc. (other data, irrelevant to task at hand)
>    (yeah I know the structure sucks, can't do anything about it)
> - target (maven scratchpad)
>    - classes (files for main artifact jar are collected here I think)
>
> I need the files inside libs/cubes.jar and libs/cubes-resource.jar
> unpacked and placed inside target/classes, preserving the in-jar
> directory structure.
>
> I want this to run in the process-classes, latest, because that's the
> last pertinent phase that m2e will run.
>
> What's the best (least-hassle) plugin that will do this?
>
> Regards,
> Jo

-Tim

>
> P.S.: Please resist the temptation to tell me that I want the wrong
> thing. I need help with solving a problem, I don't need a lecture.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message