java - Maven Uberjar as Maven Dependency -
i'm working legacy app, process building plugins requires adding dependencies on 150 non-maven (ant believe?) jar files. ideally, i'd package these 150-jars single jar, place on artifactory, , use maven-dependency team can more setup development environment.
i've been experimenting one-jar, maven-assembly-plugin, , maven-shade-plugin, appears create 1 jar contains several other jars (i.e. unzip contents). when adding jar maven dependency, maven appears unable resolve contents/dependencies within these "sub-jars."
the code below example of i've tried; feel free suggest other approaches.
<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.company</groupid> <artifactid>some-jars</artifactid> <packaging>jar</packaging> <version>1.0.0</version> <name>somename</name> <properties> <jdk.version>1.8</jdk.version> </properties> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <configuration> <archive> <manifest> <mainclass>com.mycompany.mypackage.mymainclass</mainclass> </manifest> </archive> </configuration> </plugin> <plugin> <groupid>org.dstovall</groupid> <artifactid>onejar-maven-plugin</artifactid> <version>1.4.4</version> <executions> <execution> <configuration> <binlibs> <fileset> <directory>${basedir}/jars</directory> <includes> <include>*</include> </includes> </fileset> </binlibs> <!-- optional, default false --> <attachtobuild>true</attachtobuild> <!-- optional, default "onejar" --> <classifier>onejar</classifier> </configuration> <goals> <goal>one-jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <pluginrepositories> <pluginrepository> <id>onejar-maven-plugin.googlecode.com</id> <url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url> </pluginrepository> </pluginrepositories> </project>
perhaps may want consider bom approach adopted spring io platform (http://platform.spring.io/platform/#quick-start), jboss java ee 6 spec dependency in maven (http://www.andygibson.net/blog/quickbyte/jboss-java-ee-6-spec-dependency-in-maven/)
by using bom approach, there no need bundle libraries 1 single jar.
Comments
Post a Comment