How about using  shading twice using two different projects (or subprojects) 
one to build a shaded minified jar then another one depending on the first one 
just shading the drivers and the result jar from the first shade operation 
without minifyJar this time?

-----Original Message-----
From: Oliver Schrenk [mailto:oliver.schr...@gmail.com] 
Sent: 13. desember 2011 14:59
To: Stephen Connolly
Cc: Maven Users List
Subject: Re: maven-shade-plugin, minifyJar removes classes used in 
Class.forName(...)

Good idea. Might work.

The problem is that the name of the driver is read from a properties file, so I 
only have a String to go on.

Am 13.12.2011 um 13:38 schrieb Stephen Connolly:

> try {
>  Class.forName(oracle.jdbc.driver.OracleDriver.class.getName())
> } catch (LinkerError e) {
>  // ignore
> }
> 
> :-P
> 
> On 13 December 2011 12:04, Oliver Schrenk <oliver.schr...@gmx.net> wrote:
>> Hej,
>> 
>> I'm using the maven-shade-plugin to create an executable jar. The number of 
>> included jars blows the final jar over 10+ MB. Using the `minifyJar` 
>> instruction, reduces it to 2.8 MB.
>> 
>> Unfortunately it will remove the classes for the database driver. I assume 
>> its because they are included via
>> 
>>        Class.forName("oracle.jdbc.driver.OracleDriver")
>> 
>> and aren't found during the minifying process.
>> 
>> I tried including it via
>> 
>>        <configuration>
>>             <artifactSet>
>>               <includes>
>>                 <include>com.oracle:ojdbc6</include >
>>               </includes >
>>             </artifactSet>
>>           </configuration>
>> 
>> but this removes all other classes.
>> 
>> How can I minify the shaded jar and still include the database driver?
>> 
>> 
>> Best regards
>> Oliver Schrenk
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
> 


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


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

Reply via email to