Maven 정복 - 6. Repository(저장소)

  • Maven은 Repository라는 개념이 있으며, Local Repository, Repository, Plugin Repository 3가지로 구분된다.

1. Local Repository(로컬 저장소)

  • Maven은 dependency 및 packaging한 프로젝트 결과물을 local에 특정 위치에 저장
    • Linux & Mac : <홈디렉토리>/.m2
    • Windows : C:\Users<유저이름>/.m2
  • .m2 디렉토리 하위에 dependency 및 packaging한 결과물들을 groupId, artifactId, versions값으로 하위 디렉토리구조가 생성이 되며 저장된다. 6-1

  • 여러 프로젝트에서 중복된 라이브러리 다운로드를 피하기위한 목적을 가진다.

2. Repository

  • 의존성을 다운로드 받을 위치의 repository
  • 기술되지 않을 시 기본적인 위치
  • 다수의 <repository> 기술 가능
  • 회사 내부의 repository를 기술 하기도 한다.
    • nexus
    • artifactory를 이용
    ...생략	
	<repositories>
		<repository>
            <id>spring-snapshot</id>
            <name>Spring Snapshot Repository</name>
            <url>https://repo.spring.io/snapshot</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
	</repositories>

3. Plugin Repository

  • maven plugin을 다운로드 받을수 있는 저장소 위치를 기술
  • 다수 <pluginRepository> 기술 가능
<pluginRepositories>
    <pluginRepository>
        <id>acme corp</id>
        <name>Acme Internal Corporate Repository</name>
        <url>http://acmecorp.com/plugins</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
    </pluginRepository>
</pluginRepositories>