spring - Jar-With-Dependencies not including dependency -
i trying package applicaction using jar-with-dependencies
i using spring-rabbit
<dependency> <groupid>org.springframework.amqp</groupid> <artifactid>spring-rabbit</artifactid> <version>${spring.amqp.version}</version> </dependency>
which requires spring-retry. added (managed 1.0.3.release version) :
<dependency> <groupid>org.springframework.retry</groupid> <artifactid>spring-retry</artifactid> </dependency>
i using following plugin:
<plugin> <artifactid>maven-assembly-plugin</artifactid> <version>2.4.1</version> <configuration> <archive> <manifest> <addclasspath>false</addclasspath> <mainclass>com.my.main.class.package.mainclass</mainclass> <packagename>com.my.main.class.package</packagename> </manifest> </archive> <descriptorrefs> <descriptorref>jar-with-dependencies</descriptorref> </descriptorrefs> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin>
however noclassdeffounderror
replycaller (included in rabbittemplate). when inspect contents of jar there no org/springframeowork/retry folder. how can fix this?
entire pom file:
<?xml version="1.0" encoding="utf-8"?> <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/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <parent> <groupid>com.my.other</groupid> <artifactid>project</artifactid> <version>versionname</version> <relativepath>../pom.xml</relativepath> </parent> <artifactid>my-project</artifactid> <packaging>jar</packaging> <name>my project<name> <dependencies> <dependency> <groupid>com.my.other</groupid> <artifactid>parent</artifactid> <version>${project.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework.retry</groupid> <artifactid>spring-retry</artifactid> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework.amqp</groupid> <artifactid>spring-amqp</artifactid> <version>${spring.amqp.version}</version> </dependency> <dependency> <groupid>org.springframework.integration</groupid> <artifactid>spring-integration-amqp</artifactid> <version>${spring.integration.version}</version> </dependency> <dependency> <groupid>org.springframework.integration</groupid> <artifactid>spring-integration-core</artifactid> <version>${spring.integration.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-test</artifactid> <version>${spring.version}</version> <scope>test</scope> </dependency> <dependency> <groupid>org.springframework.amqp</groupid> <artifactid>spring-rabbit</artifactid> <version>${spring.amqp.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-beans</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-aop</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-amqp</artifactid> <version>${spring.boot.version}</version> <exclusions> <exclusion> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-amqp-logging</artifactid> </exclusion> <exclusion> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-logging</artifactid> </exclusion> </exclusions> </dependency> <dependency> <groupid>org.codehaus.jackson</groupid> <artifactid>jackson-core-asl</artifactid> <version>${jacksonversion}</version> </dependency> <dependency> <groupid>org.codehaus.jackson</groupid> <artifactid>jackson-mapper-asl</artifactid> <version>${jacksonversion}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <configuration> <archive> <manifest> <addclasspath>false</addclasspath> <mainclass>com.my.main.class.package.mainclass</mainclass> <packagename>com.my.main.class.package</packagename> </manifest> <manifestentries> <class-path>my-other-project-${commons.version}.jar</class-path> </manifestentries> </archive> </configuration> </plugin> <plugin> <artifactid>maven-assembly-plugin</artifactid> <version>2.4.1</version> <configuration> <archive> <manifest> <addclasspath>false</addclasspath> <mainclass>com.my.main.class.package.mainclass</mainclass> <packagename>com.my.main.class.package</packagename> </manifest> </archive> <descriptorrefs> <descriptorref>jar-with-dependencies</descriptorref> </descriptorrefs> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <properties> <jacksonversion>1.9.12</jacksonversion> <spring.version>4.0.6.release</spring.version> <spring.integration.version>4.0.3.release</spring.integration.version> <spring.amqp.version>1.3.5.release</spring.amqp.version> <spring.boot.version>1.1.4.release</spring.boot.version> </properties> </project>
i resorted removing jar-with-dependencies , using springboot plugin. had add dependencies had in other project project however.
<build> <plugins> <plugin> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> <version>1.1.3.release</version> <configuration> <mainclass>com.my.main.class.package.mainclass</mainclass> <layout>zip</layout> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
Comments
Post a Comment