오늘 작업한내용을 간단하게 리마인더용으로 작성
1. nexus 설치
2. 레파지토리 생성
3. 배포용 프로젝트 세팅
4. nexus에 배포
5. 호출용 프로젝트 세팅
배포용 프로젝트 세팅
프로젝트도 최소한으로 간단하게 만들고... 고고링하자
메이븐 프로젝트를 만들고
간단한 클래스를 만들고 입력받은 문자열을 출력하는 메소드를 작성했다
package com.kiwoong.util;
public class ToyUtil {
public static void printString(String str) {
System.out.println(str);
}
}
Nexus에 배포
이제 위에 만든 프로젝트를 Nexus에 배포해보자
pom.xml에 repository 정보를 넣자
... 생략
<distributionManagement>
<repository>
<id>to-snapshot</id>
<name>test-lib</name>
<url>http://localhost:7080/repository/test-lib/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
...생략
distributionManagement 배포 관리자를 셋팅
id : setting.xml 에 설정했던 server id
name : nexus 레파지토리의 name
url : 레파지토리 주소 ( 레파지토리 주소는 nexus의 repository 목록에 가면 URL 에 copy 버튼으로 복사할 수 있다 )
입력이 끝났으면 배포를 해보자
mvn clean deploy
C:\workspace\deploytest>mvn clean deploy
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------< com.kiwoong:deploytest >-----------------------
[INFO] Building deploytest 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ deploytest ---
[INFO] Deleting C:\workspace\deploytest\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ deploytest
[WARNING] Using platform encoding (MS949 actually) to copy filtered resources, i
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ deploytest --
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding MS949, i.e. bu
[INFO] Compiling 1 source file to C:\workspace\deploytest\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ de
[WARNING] Using platform encoding (MS949 actually) to copy filtered resources, i
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ deplo
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding MS949, i.e. bu
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ deploytest ---
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ deploytest ---
[INFO] Building jar: C:\workspace\deploytest\target\deploytest-0.0.1-SNAPSHOT.ja
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ deploytest ---
[INFO] Installing C:\workspace\deploytest\target\deploytest-0.0.1-SNAPSHOT.jar t
[INFO] Installing C:\workspace\deploytest\pom.xml to C:\Users\kiwoong\.m2\reposi
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ deploytest ---
Downloading from to-snapshot: http://localhost:7080/repository/test-lib/com/kiwo
Uploading to to-snapshot: http://localhost:7080/repository/test-lib/com/kiwoong/
Uploaded to to-snapshot: http://localhost:7080/repository/test-lib/com/kiwoong/d
Uploading to to-snapshot: http://localhost:7080/repository/test-lib/com/kiwoong/
Uploaded to to-snapshot: http://localhost:7080/repository/test-lib/com/kiwoong/d
Downloading from to-snapshot: http://localhost:7080/repository/test-lib/com/kiwo
Uploading to to-snapshot: http://localhost:7080/repository/test-lib/com/kiwoong/
Uploaded to to-snapshot: http://localhost:7080/repository/test-lib/com/kiwoong/d
Uploading to to-snapshot: http://localhost:7080/repository/test-lib/com/kiwoong/
Uploaded to to-snapshot: http://localhost:7080/repository/test-lib/com/kiwoong/d
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.527 s
[INFO] Finished at: 2022-05-05T20:35:57+09:00
[INFO] ------------------------------------------------------------------------
로그는 별 문제 없어보이니 Nexus로 가서 확인해보자
우리가 만든 프로젝트가 정상적으로 Nexus에 배포된 것을 확인할 수 있다
버전을 Release Snapshot으로 나누어서 작업하지만
일단 글을 작성하는 이유는 단순히 넥서스에 배포를 위한 목적이므로 나중에 내용을 추가하던지 함
이제 이걸 가지고 와보면 끝이다