빽기의 코딩공부Story

[Sonatype Nexus 3] Windows 10 "Nexus 3" Maven 저장소 구축하기2 본문

[OS]/[CentOS]

[Sonatype Nexus 3] Windows 10 "Nexus 3" Maven 저장소 구축하기2

빽기 2021. 1. 16. 01:53

■ Maven 설치

maven.apache.org/download.cgi

 

Maven – Download Apache Maven

Downloading Apache Maven 3.6.3 Apache Maven 3.6.3 is the latest release and recommended version for all users. The currently selected download mirror is https://downloads.apache.org/. If you encounter a problem with this mirror, please select another mirro

maven.apache.org

maven 다운로드
압축 풀기

■ 사용자경로 이동

./m2경로에 pom.xml, setting.xml 생성

■ pom.xml 작성

<project> 
<modelVersion> 4.0.0 </modelVersion> 
<groupId> com.example </groupId> 
<artifactId> nexus-proxy </artifactId> 
<version> 1.0-SNAPSHOT </version> 
<dependencies> 
<dependency> 
<groupId> junit </groupId> 
<artifactId> junit </artifactId> 
<version> 4.10 </version> 
</dependency> 
</dependencies> 
</project>

 ■ setting.xml 작성

<settings>
  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:8081/repository/maven-proxy-test/</url>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
<activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
  <servers>
    <server>
      <id>nexus</id>
      <username>admin</username>
      <password>your-password</password> 
    </server>
  </servers>
</settings>

■ mvn package

■ Nexus proxy repository 확인하기

Comments