Maven Deploy to Nexus

1. pom.xml편집

여기저기 할게 많은데… 이 부분이 중요
xml에서 deploy할 nexus주소를 적어준다

    <distributionManagement>
        <repository>
            <id>beansugar-release</id>
            <url>http://{your nexus address}/{releaseRepoId}</url>
        </repository>
        <snapshotRepository>
            <id>beansugar-snapshot</id>
            <url>http://{your nexus address}/{snapshotRepoId}</url>
        </snapshotRepository>
    </distributionManagement>

2. nexus셋팅

Repo를 하나 생성

deploy계정 생성

3. settings.xml 셋팅

기본위치 ~/.m2/settings.xml
사용자는 pom.xml에 기록한 nexus 아이디 패스워드 deploy 권한을 가지고 있는 계정
id는 사용자 아이디가 아닌 repository id

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <servers>
        <server>
            <id>{release repo id}</id>
            <username>{userId}</username>
            <password>{userPassword}</password>
        </server>
        <server>
            <id>{snapshot repo id}</id>
            <username>{userId}</username>
            <password>{userPassword}</password>
        </server>
    </servers>
</settings>

4. maven testcase 오류나는 경우

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
      <testFailureIgnore>true</testFailureIgnore>
    </configuration>
</plugin>

5. 기타 배포오류

404 주소를 잘못친듯

502 주소를 잘못친듯

503 권한 안줘서 user_role, privileges 설정에서 권한을 줘야한다. 배포는 edit 권한