아래 링크에 걸려 있는 정보를 이용해서 Github을 리포지토리로 사용을 해 보았다.
http://stackoverflow.com/questions/14013644/hosting-a-maven-repository-on-github/14013645#14013645
위 글을 보고 열심히 따라서 Maven pom.xml 파일을 작성한 뒤에 흥분되는 마음으로 mvn deploy 명령어를 실행하자, 아래와 같은 오류 메시지가 출력되었다.
[ERROR] Failed to execute goal com.github.github:site-maven-plugin:0.7:site (default) on project jasmine-maven-plugin: Error creating blob: Missing or invalid User Agent string. See http://developer.github.com/v3/#user-agent-required (403) -> [Help 1]
이런! 구글링을 해 보니, 깃헙의 site-maven-plugin 설정에 아래와 같은 내용을 추가해야 함을 알 수 있었다.
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.7</version>
<configuration>
<message>Maven artifacts for ${project.version}</message>
<noJekyll>true</noJekyll>
<outputDirectory>${project.build.directory}/mvn-repo</outputDirectory>
<branch>refs/heads/mvn-repo</branch>
<merge>true</merge> <!-- 이것도 추가 -->
<includes>
<include>**/*</include>
</includes>
<repositoryName>깃헙리포지토리이름</repositoryName>
<repositoryOwner>깃헙ID</repositoryOwner>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
<!-- site-maven-plugin 0.7 버전에서 에러 안 나도록, 아래 내용 추가 -->
<dependencies>
<dependency>
<groupId>org.eclipse.mylyn.github</groupId>
<artifactId>org.eclipse.egit.github.core</artifactId>
<version>2.0.3</version>
</dependency>
</dependencies>
</plugin>
그리고, <merge> 속성의 값을 true로 지정해 주었다. <merge>가 false일 경우 기존 내용이 삭제되기 때문에, 이전 버전이 유지가 되지 않는다. 이전 버전을 유지하고 싶지 않더라도 Maven 멀티 모듈을 사용하고 있다면 이 속성을 true로 지정해 주어야 한다. 그렇지 않을 경우, 멀티 모듈의 각 모듈이 리포지토리에 배포될 때 마다 이전에 올라간 것들을 지우기 때문에, 최종적으로 한 개의 서브 모듈만 리포지토리에 올라가게 된다.