여러 Maven 모듈에서 단일 실행 파일 jar를 빌드하는 데 문제가 있습니다. 그래서 여기 상황입니다 : 나는 3 개의 maven 모듈을 가지고 있습니다 : app -> persistence -> domain. 나는 부모 pom.xml도 가지고있다. 그래서여러 개의 Maven 모듈에서 실행 가능한 jar 빌드하기
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.toys.app.Service</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
내가 (parent.pom 및 응용 프로그램, 지속성 및 도메인 받는다는 모듈을 포함하는) 부모 치어 디렉토리에 명령 줄에서 입력 한 명령 : MVN 조립 : 조립 나는이 부모 치어 받는다는 조립 플러그인에 추가
[INFO] ------------------------------------------------------------------------
[INFO] Building persistence 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-assembly-plugin:2.2-beta-5:single (default-cli) @ persistence ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] parent ..................................... SUCCESS [3.147s]
[INFO] domain ............................................ SUCCESS [4.765s]
[INFO] persistence ....................................... FAILURE [0.570s]
[INFO] app ............................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.287s
[INFO] Finished at: Wed Sep 28 12:30:26 CEST 2011
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default-cli) on project persistence: Failed to create assembly: Failed to resolve dependencies for project: com.toys:persistence:jar:1.0-SNAPSHOT: Missing:
[ERROR] ----------
[ERROR] 1) com.toys:domain:jar:1.0-SNAPSHOT
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=com.toys -DartifactId=domain -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=com.toys -DartifactId=domain -Dversion=1.0-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) com.toys:persistence:jar:1.0-SNAPSHOT
[ERROR] 2) com.toys:domain:jar:1.0-SNAPSHOT
[ERROR]
[ERROR] ----------
[ERROR] 1 required artifact is missing.
[ERROR]
[ERROR] for artifact:
[ERROR] com.toys:persistence:jar:1.0-SNAPSHOT
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :persistence
다른 모든 받는다는 수명주기가 잘 작동 : 그것은 나의 다음 오류를 준! 누구든지 나를 도울 수 있습니까? 나는 앱, 지속성, 도메인 프로젝트와 같은 수준에 프로젝트 '유통'을 추가 제안
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.toys.app.Service</mainClass>
</manifest>
</archive>
<descriptorRef>jar-with-dependencies</descriptorRef>
</configuration>
<executions>
<execution>
<id>make-jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
이러한 종속성의 범위는 무엇입니까? – Thomas
기본값은 "compile"입니다. –