티스토리 뷰

개인적으로 개발 중인 서버 프레임워크 및 기타 Github 소스들을 쉽게 제공하기 위해서(나에게 제공...;;) maven 을 사용할 수 있는 방법을 찾던 중 혹시나 Github 에 있지 않을까 해서 확인해보니 역시나 있었다!

https://github.com/github/maven-plugins

잘 정리가 되어 있어서 일단 따라해 봤다.

maven 폴더 안에 있는 settings.xml 에 github 으로 파일을 올리기 위한 설정이 필요하기 때문에 github 의 계정 정보를 설정해 주었다.

내 settings.xml 위치
C:\Users\user\.m2\repository

<servers> <server> <id>github</id> <username>github id</username> <password>github password</password> </server> </servers>

그리고 프로젝트 안의 pom.xml 에 example 에 있는 plugin 을 추가해 준다.

<build>
  <plugins>
    <plugin>
      <groupId>com.github.github</groupId>
      <artifactId>site-maven-plugin</artifactId>
      <version>0.12</version>
      <configuration>
        <message>Creating site for ${project.version}</message>
      </configuration>
      <executions>
        <execution>
          <goals>
            <goal>site</goal>
          </goals>
          <phase>site</phase>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

야심차게 mvn site 를 실행했지만 실패...

더 찾다보니 이미 하신분이 한글로 잘 정리해준 블로그가 있었다..고맙습니다 ㅠㅠ

http://javacan.tistory.com/entry/Github%EC%9D%84-Maven-repository%EB%A1%9C-%EC%82%AC%EC%9A%A9%ED%95%A0-%EB%95%8C-%EC%A3%BC%EC%9D%98%EC%82%AC%ED%95%AD

그리고 이 안에서 다시 stackvoerflow 가 연결되 있었고 여기를 보면서 다시 시작했다.

https://stackoverflow.com/questions/14013644/hosting-a-maven-repository-on-github/14013645#14013645

아래 내용을 추가하고 deploy 를 실행해 보면 target 폴더 및으로 mvn-repo 가 생기는 것을 볼 수 있다. 

<distributionManagement>
    <repository>
        <id>internal.repo</id>
        <name>Temporary Staging Repository</name>
        <url>file://${project.build.directory}/mvn-repo</url>
    </repository>
</distributionManagement>

<plugins>
    <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>2.8.1</version>
        <configuration>
            <altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository>
        </configuration>
    </plugin>
</plugins>


이제 이렇게 생성된 것을 mvn site 를 통해서 올려야 하기 때문에 plugin 의 configuration 을 수정한 뒤 실행했다.

<build> <plugins> <plugin> <groupId>com.github.github</groupId> <artifactId>site-maven-plugin</artifactId> <version>0.12</version> <configuration> <message>Creating site for ${project.version}</message> <outputDirectory>${project.build.directory}/mvn-repo</outputDirectory> <branch>refs/origin/mvn-repo</branch> <includes><include>**/*</include></includes> <repositoryName>ExOf</repositoryName> <repositoryOwner>KNero</repositoryOwner>

</configuration> <executions> <execution> <goals> <goal>site</goal> </goals> <phase>site</phase> </execution> </executions> </plugin> </plugins> </build>

여기 까지 하고 실행하면 아까 한글로 정리해 주신 분과 같은 에러가 발생했다. 성공하지 않았지만 성공한거 같은 느낌이었다;;

아까 블로그 의 밑에 부분에 있는 내용인 configuration 의 merge 설정을 추가하고 com.github.github plugin 의 executions 밑으로 dependencies 를 추가해준다. 최종적으로 설정한 plugin 설정이다.

<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.12</version>
<configuration>
<message>Creating site for ${project.version}</message>
<outputDirectory>${project.build.directory}/mvn-repo</outputDirectory>
<branch>refs/origin/mvn-repo</branch>
<includes><include>**/*</include></includes>
<repositoryName>ExOf</repositoryName>
<repositoryOwner>KNero</repositoryOwner>
<merge>true</merge>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>site</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.4</version>
</dependency>
</dependencies>
</plugin>


마지막에 아래와 같은 로그가 남는다면 성공이다.

[INFO] Creating 9 blobs
[INFO] Creating tree with 9 blob entries
[INFO] Merging with tree ca9b3a817c1b03b4282d2dafe21bf6d09d84ae8a
[INFO] Creating commit with SHA-1: df708d8047bc13a8c202bfb13e6ee17dc89dbeca
[INFO] Updating reference refs/origin/mvn-repo from a56cea9b18d2d399a9849589c2857519da0b8f6f

여기 까지 하고 확인을 해보려 했지만 웹으로 확인이 안됐다...ㅠㅠ 

그래서 확인을 위해 다른 프로젝트에서 pom.xml 에 아래와 같이 설정을 추가했더니 .m2 폴더에 내 라이브러리가 다운받아지는 것을 확인 할 수 있었다!

<repository>
    <id>KNero-mvn-repo</id>
    <url>https://raw.github.com/KNero/ExOf/mvn-repo</url>
    <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
    </snapshots>
</repository>


<dependency>
    <groupId>team.balam</groupId>
    <artifactId>exof</artifactId>
    <version>1.3.0</version>
</dependency>


이제 제 프레임워크를 광고..?

https://github.com/KNero/ExOf/wiki

'IT > 개발' 카테고리의 다른 글

레거시에 Solr 적용하기  (0) 2018.05.22
Redis HA  (0) 2018.04.05
Garbage Collection  (0) 2017.02.04
Object class  (0) 2017.02.01
Socket Option  (0) 2016.01.02
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함