[댓 글]Maven 중<br>노드 와<br>노드 의 차이
5140 단어 mavendependencies
설명 은 다음 과 같다.
1.아 이 템 상속 사용
프로젝트 계승 을 이용 하여 구조 정보,배치 정보,공 통 된 의존 정 보 를 단일 한 위치 에 놓 을 수 있다.모든 프로젝트 의 pom 에서:
<parent>
<groupId>org.apache.maven.proficio</groupId>
<artifactId>proficio</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
이 때문에 프로젝트 의 pom 은 최상 위 pom 의 정 의 를 계승 하여 최상 위 pom 의 dependencies 부분 을 검사 할 수 있 습 니 다.
<project>
<dependencies >
<dependency >
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency >
</dependencies >
</project>
각 하위 모듈 의 pom 에 서 는 Junit 의존 에 대한 정의 가 없 지만,최상 위 pom 에서 의존 하 는 정 의 를 계승 합 니 다.
하위 모듈 pom 이 있 는 디 렉 터 리 에서 명령 을 수행 할 수 있 습 니 다.
#mvn help:effective-pom
최종 효과 가 있 는 pom 을 볼 수 있 습 니 다.잘못 찾 았 을 때 효과 가 있 습 니 다.
2.관리 의존
pom 에서 dependency management 요 소 를 가리 키 는 방식 maven 은 프로젝트 계승 과 결합 하여 의존 도 를 관리 합 니 다.다 중 모듈 응용 에서 여러 개의 하위 항목 이 공통 적 으로 의존 할 수 있 습 니 다.이 때 올 바 르 게 실행 하기 위해 서 는 모든 하위 항목 이 의존 항목 의 같은 버 전 을 사용 하도록 해 야 합 니 다.응용 항목 의 의존 항목 과 버 전이 일치 해 야 테스트 와 발표 가 같은 성 과 를 보장 할 수 있 습 니 다.따라서 꼭대기 층 의 pom 에서 공 통 된 의존 관 계 를 정의 해 야 한다.
Proficio 에서 사용 하 는 최상 위 pom 의 dependency management 단 계 는 다음 과 같 습 니 다.
<dependencyManagement>
<dependencies >
<dependency >
<groupId>com.devzuz.mvnbook.proficio</groupId>
<artifactId>proficio-model</artifactId>
<c>${project.version}</version>
</dependency >
<dependency >
<groupId>com.devzuz.mvnbook.proficio</groupId>
<artifactId>proficio-api</artifactId>
<version>${project.version}</version>
</dependency >
<dependency >
<groupId>com.devzuz.mvnbook.proficio</groupId>
<artifactId>proficio-core</artifactId>
<version>${project.version}</version>
</dependency >
<dependency >
<groupId>com.devzuz.mvnbook.proficio</groupId>
<artifactId>proficio-store-memory</artifactId>
<version>${project.version}</version>
</dependency >
<dependency >
<groupId>com.devzuz.mvnbook.proficio</groupId>
<artifactId>proficio-store-xstream</artifactId>
<version>${project.version}</version>
</dependency >
<dependency >
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<version>1.0-alpha-9</version>
</dependency >
</dependencies >
</dependencyManagement>
${procject.version}변 수 는 응용 버 전 을 말 합 니 다.
최상 위 pom 의 dependencies 와 dependency Management 의 dependencies 요 소 는 중요 한 차이 가 있 습 니 다.
dependency Management 의 dependencies 요 소 는 의존 항목 버 전의 우선 선택 만 표시 하고 프로젝트 의 의존 항목 에 영향 을 주지 않 습 니 다.dependencies 요 소 는 프로젝트 의 의존 항목 에 영향 을 줍 니 다.
Proficio api 모듈 의 pom 검사:
<project>
<parent>
<groupId>com.devzuz.mvnbook.proficio</groupId>
<artifactId>proficio</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>proficio-api</artifactId>
<packaging>jar</packaging>
<name>Proficio API</name>
<dependencies >
<dependency >
<groupId>com.devzuz.mvnbook.proficio</groupId>
<artifactId>proficio-model</artifactId>
</dependency >
</dependencies >
</project>
의존 항목 의 버 전 정 보 를 가리 키 지 않 았 습 니 다.최상 위 pom 의 dependency Management 에서 선택 한 버 전 은${procject.version}즉 1.0-NAPSHOT 입 니 다.모듈 pom 을 완전 하 게 하기 위해 버 전 정 보 를 주입 합 니 다.
외부 dependencies 요소 에 버 전 정 보 를 가리 키 지 않 았 을 때 dependency Management 의 dependencies 요소 가 작 동 합 니 다.
메모:하 나 는 프로젝트 의존 이 고 하 나 는 다 중 모듈 maven 프로젝트 의 의존 관리 제어 입 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Windows에서 CodeArtifact(Maven)용 토큰을 자동으로 생성하는 방법CodeArtifact를 사용한 적이 있거나 사용할 계획이라면 매일 모든 Maven 프로젝트에서 수동으로 토큰(CODEARTIFACT_AUTH_TOKEN)을 생성해야 합니다. 이는 어려울 수 있으며 개발 속도를 늦출...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.