http://blog.artifact-software.com/tech/?p=121
On 14/09/2011 9:02 AM, Ron Wheeler wrote:
We build aggregated jars all the time with the standard Maven plug-ins.
We build a single Spring-Hibernate-MySQL jar that includes all the
classes required to use all three of these packages.
We drop this into the Tomcat shared library so that it is set as
"provided" in each of our modules which really reduces the size of the
war files.
We do the same thing for the utility libraries (mostly Apache) that we
use.
Also for JasperReports.
They are all structured in the same way.
I have attached the pom for JasperReports since it is short and shows
a first level aggregation
The second pom shows how we aggregate lower level libraries to make a
single library "spring-hibernate-mysql-tomcat" from
"hibernate-mysql-tomcat" and "spring".
Notes:
1) Just using the maven-assembly-plugin. Shade should work as well but
we have never used it.
2) We carefully exclude libraries that are provided elsewhere.
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.artifact_software.lms</groupId>
<artifactId>lms-pom-jasper</artifactId>
<packaging>pom</packaging>
<name>lms Pom for Jasper</name>
<version>1.9.1</version>
<properties>
<jasperreports.version>3.7.4</jasperreports.version>
<jfreechart.version>1.0.12</jfreechart.version>
<jcommon.version>1.0.15</jcommon.version>
<itext.version>2.1.0</itext.version>
<jdtcore.version>3.1.0</jdtcore.version>
<bouncycastle.version>136</bouncycastle.version>
</properties>
<description>dependency pom for projects requiring Jasper</description>
<parent>
<artifactId>lms-pom-master</artifactId>
<groupId>com.artifact_software.lms</groupId>
<version>1.9.1</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>${jasperreports.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<artifactId>commons-beanutils</artifactId>
<groupId>commons-beanutils</groupId>
</exclusion>
<exclusion>
<artifactId>commons-collections</artifactId>
<groupId>commons-collections</groupId>
</exclusion>
<exclusion>
<artifactId>commons-digester</artifactId>
<groupId>commons-digester</groupId>
</exclusion>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
<exclusion>
<artifactId>itext</artifactId>
<groupId>com.lowagie</groupId>
</exclusion>
<exclusion>
<artifactId>jdtcore</artifactId>
<groupId>eclipse</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>${jfreechart.version}</version>
</dependency>
<dependency>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<groupId>bouncycastle</groupId>
<artifactId>bcmail-jdk14</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<groupId>eclipse</groupId>
<artifactId>jdtcore</artifactId>
<version>${jdtcore.version}</version>
</dependency>
<!-- <dependency>
<groupId>jfree</groupId>
<artifactId>jcommon</artifactId>
<version>${jcommon.version}</version>
</dependency> -->
</dependencies>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.artifact_software.util</groupId>
<artifactId>util-pom-spring-hibernate-mysql-tomcat</artifactId>
<packaging>pom</packaging>
<name>Spring, Hibernate, MySQL-Tomcat</name>
<version>1.0</version>
<parent>
<artifactId>util-pom-master</artifactId>
<groupId>com.artifact_software.util</groupId>
<version>1.0</version>
</parent>
<description>Spring, MySQL, Hibernate, Tomcat configuration</description>
<properties>
</properties>
<dependencies>
<dependency>
<groupId>com.artifact_software.util</groupId>
<artifactId>util-pom-hibernate-mysql-tomcat</artifactId>
<version>${util.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.artifact_software.util</groupId>
<artifactId>util-pom-spring</artifactId>
<version>${util.version}</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
On 13/09/2011 6:41 PM, jaybytez wrote:
I have developers that receive the Eclipse 87 error because the
classpath is
too long from too many jar files.
I want to recreate a Spring full jar like they used to in 2.5.6, the
problem
is that if I used jarjar...I would have to build a pom so that all the
transitive Spring dependencies were defined in the pom because I only
want
to jarjar the Spring jars.
Can I use Shade instead to resolve this? Can I build a pom file of
Spring
dependencies and use Shade to jar together the Spring jars only and
output a
pom file that includes dependencies not added to the new jar?
Thanks for the help,
Jay
--
View this message in context:
http://maven.40175.n5.nabble.com/Using-Shade-to-create-a-full-jar-like-Spring-full-jar-tp4800558p4800558.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
Ron Wheeler
President
Artifact Software Inc
email: [email protected]
skype: ronaldmwheeler
phone: 866-970-2435, ext 102
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]