2011-03-11 6 views
2

Spring과 My Sql 라이브러리 (mysql-connector)에 의존성이있는 간단한 Maven 프로젝트 (패키징 유형 - Jar)를 만들었습니다. $mvn package으로이 프로젝트를 패키징 할 때이 명령을 성공적으로 실행 한 후에 jar 파일을 얻습니다.jar-with-dependencies Maven 어셈블리

나는 또한 출력 jar 파일에있는 모든 종속성을 포함하도록 노력하고, 그래서 나는 '항아리-와 의존성'조립 기술자를 추가했지만 문서가 말한대로 :

The `jar-with-dependencies` descriptor builds a JAR archive with the contents of the main project jar along with the unpacked contents of all the project’s runtime dependencies. 

내가 포함 할 종속성은 JAR 양식이 아니라 unpacked입니다. 어떻게해야합니까?

답변

4

Java는 사용자의 항아리에있는 병에서 항아리의 클래스를로드 할 수 없습니다. one-jarmaven plugin과 같은 프로젝트로 구성해야합니다.

0

비키가 항아리를 집계하려고하는 데 도움이는 Maven의 관점에서 "건물-AN-총 항아리"로 알려져있다. Robert의 [1] 및 Artifact Technical Notes [2] 블로그에서 더 많은 것을 찾을 수 있습니다. 도움이 될 수있는 한 가지 토론 [3].

안부

[1] http://rombertw.wordpress.com/2010/05/14/maven-recipe-building-an-aggregate-jar/

[2] http://blog.artifact-software.com/tech/?p=121

[3] http://maven.40175.n5.nabble.com/Aggregate-POM-for-thirdparty-package-dependencies-not-downloaded-td113927.html