maven 다중 모듈 빌드로 이동 중입니다. 다음과 같이Eclipse와 Maven 다중 모듈 빌드
내 프로젝트 구조는 같습니다
MyProject
|-->MyProject-Core
| |->pom.xml (packaging jar)
|-->MyProject-Assets
| |->pom.xml (packaging jar)
|-->MyProject-Libs
| |->pom.xml (packaging jar)
|-->pom.xml (packaging pom, aggregator)
MyProject
Eclipse 원본 폴더로 MyProject-Core/src/main/java를 추가했지만 부모 pom의 종속성 섹션을 dependencyManagement로 변경했기 때문에 Eclipse에서 빌드 오류가 발생했습니다. 수동으로 mvn package
을 호출해도 정상적으로 작동합니다.
어떻게 핵심 pom의 종속성을 올바르게 해결할 수있는 Eclipse를 구성 할 수 있습니까?
여전히 부모 pom에 종속성을 scope : provide로 추가 할 수 있지만 이것이 최선의 해결책입니까?
학부모 응원단 :
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>MyProject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.3.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence
on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
exec-maven-plugin
</artifactId>
<versionRange>
[1.2,)
</versionRange>
<goals>
<goal>java</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<index>true</index>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<packageName>com.example</packageName>
<addDefaultImplementationEntries>true
</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true
</addDefaultSpecificationEntries>
</manifest>
<manifestEntries>
<SVN-Revision>${workingCopyDirectory.revision}</SVN-Revision>
</manifestEntries>
<compress>false</compress>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>MyProject-core</module>
</modules>
</project>
코어-응원단 :
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.example</groupId>
<artifactId>MyProject</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.example</groupId>
<artifactId>MyProject-Core</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
</build>
</project>
예를 들어 pom (뿌리)과 코어의 pom을 게시하십시오. – khmarbaise
좋아, 나는 poms의 단순화 된 버전을 추가했다. – Stephan
프로젝트를 제거한 다음 다시 가져 오려고 했습니까? – cahen