tycho 를 이용해서 eclipse plugin 들을 빌드하기 위해서는 추가적으로 다음의 프로젝트가 필요하다.

- feature 프로젝트 : ex ) bizuma.ide.feature

- update site 프로젝트 : ex) bizuma.ide.update

- root 프로젝트 : ex) bizuma.ide.headless

- root 프로젝트는 packaging type 이 pom이 maven 프로젝트이다.


root 프로젝트 pom.xml 파일 작성



1.1 모듈 추가

1
2
3
4
5
<modules>
        <module>../bizmua.ide.module_a</module>
        <module>../bizmua.ide.feature</module>
        <module>../bizmua.ide.udpate</module>
    </modules>


현재 형상관리에 프로젝트가 

root

- bizuma.ide.module_a

- bizuma.ide.feature

....

와 같이 관리 되오 있다면 module 선언부에 모듈 경로는 ../ 가 없겠지만 추가하는 기존 플러그인 프로젝트로만 구성이 되어있는 상태에서 root 프로젝트를 추가하는 경우 위와 같이 경로를 잡아준다.

즉, root 프로젝트와 다른 플러그인 프로젝트는 같은 레벨에 존재 하게 될것이다.

1.2 repository 추가

1
2
3
4
5
6
7
<repositories>
        <repository>
            <id>kepler</id>
            <url>http://download.eclipse.org/releases/kepler</url>
            <layout>p2</layout>
        </repository>
    </repositories>


1.3 tycho 관련 maven 플러그인 추가

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-versions-plugin</artifactId>
                    <version>${tycho.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-maven-plugin</artifactId>
                <version>${tycho.version}</version>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <version>${tycho.version}</version>
                <configuration>
                    <environments>
                        <environment>
                            <os>linux</os>
                            <ws>gtk</ws>
                            <arch>x86</arch>
                        </environment>
                        <environment>
                            <os>linux</os>
                            <ws>gtk</ws>
                            <arch>x86_64</arch>
                        </environment>
                        <environment>
                            <os>win32</os>
                            <ws>win32</ws>
                            <arch>x86</arch>
                        </environment>
                        <environment>
                            <os>win32</os>
                            <ws>win32</ws>
                            <arch>x86_64</arch>
                        </environment>
                        <environment>
                            <os>macosx</os>
                            <ws>cocoa</ws>
                            <arch>x86_64</arch>
                        </environment>
                    </environments>
                </configuration>
            </plugin>
        </plugins>
 
    </build>


각 플러그인 모듈에 pom.xml 파일 추가



root 프로젝트의 모듈에 추가되는 플러그인 프로젝트들(feature, udpate 프로젝트 포함)에 pom.xml 파일을 추가한다.

- 일반 플러그인 프로젝트 : 일반 플러그인 프로젝트의 packaging은 eclipse-plugin 이다.

1
2
3
4
5
6
7
8
<parent>
        <groupId>bizuma.ide</groupId>
        <artifactId>bizuma.ide.headless</artifactId>
        <version>1.0.0</version>
    </parent>
    
    <artifactId>bizuma.ide.module_a</artifactId>
    <packaging>eclipse-plugin</packaging>


- feature 프로젝트 : 위와 동일한 형식으로 작성하고 feature 프로젝트의 packaging은 eclipse-feature 이다.

- update 프로젝트 : 위와 동일한 형식으로 작성하고 udpate 프로젝트의 packaging은 eclipse-repository이다.


update 프로젝트 추가작업



- udpate 프로젝트를 eclipse IDE 에서 생성할경우 category.xml 파일을 생성되지 않는다. site.xml파일만 생성된다. udpate 프로젝트에 category.xml 파일을 생성해서 feature를 추가해준다.

- category.xml 파일 수정 : feature id에 버전을 0.0.0으로 수정한다. 추후 tycho 에서 수정 할지 모르겠지만 tycho를 이용해서 플러그인 버전을 변경할시에 pom.xml과 MANIFEST.MF, feature.xml 의 버전은 모두 동기화되지만 category.xml파일에 선언한 feature 버전은 업데이트 되지 않는 문제가 발생한다. 버전이 업그래이드 되지 않아서 feature를 찾을수 없는 문제가 발생하며 빌드 자채를 할수 없게된다. 버전을 0.0.0으로 변경해서 버전에 상관없이 빌드를 진행 할 수 있도록 한다.


feature 프로젝트 추가작업



- 빌드한 플러그인 모듈들을 추가한다.


eclipse plugin 빌드



root 프로젝트(bizuma.ide.headless)로 이동한다.

- 1) mvn -N versions:update-child-modules clean install

- 모듈들을 빌드 하기 전에 parent 가 빌드가 되어 있지 않을경우 먼저 parent 를 install 하기 위함이다.

- 2) mvn clean verify


위의 과정이 성공적으로 끝나면 udpate  프로젝트(bizuma.ide.update) 의 target 폴더 하위로 빌드가 되어 있음을 확인 할 수 있다.


빌드가 완료 되었다면 jenkins에 연동하는일은 기본이니 빌드 자동화를 하도록 하자. 


eclipse plugin version upgrade



릴리즈 혹은 패치를 해서 버전을 업그레이드를 해야 할 경우 eclipse plugin 을 빌드 하기 전에 pom.xml, feature.xml, MANIFEST.MF 파일들의 버전을 업그레이드 해야 한다. 이를 위해서는 root 프로젝트에서 다음의 명령으로 maven을 실행한다.

- mvn org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=x.x.x

성공적으로 완료될경우 pom.xml, feature.xml, MANIFEST.MF 파일들의 버전이 newVersion으로 변경되었음을 확인 할 수 있다.

version이 업그레이드 되면 다시 새로운 버전으로 eclipse build를 진행한다.





블로그 이미지

비추마

,

1. git repository  에서 source check out

- git 플러그인이 설치되지 않았다면 git 플러그인을 설치 한다.(eclipse kepler user는 기본으로 설치되어 있다)

- Window -> Show View -> Git Repositories

- https://github.com/SonarSource/sonar.git (복사)

- Git Repositories 에서 Clone a Git Repository 선택(sonar git url 주소가 클립보드에 복사되어 있다면 자동으로 선택된다.)

- 소스를 check out 받으면 git 설정을 변경하지 않았다면 $USER_HOME/git/ 밑으로 체크아웃 받는다. (이클립스 구동시에 내가 선택한 workspace에 체크아웃 받지 않는다)

- Working Directory 를 선택하고 Import 를 하도록 한다.

- 현시점은 4.0-SNAPSHOT 버전이다. BRANCH 에서 자신이 빌드할 버전은 선택한다.

- import 한 프로젝트를 선택하고 Import -> Existing Maven Projects 를 선택한다. (sonar 는 maven 프로젝트로 구성되어 있다.) 

필요한 환경

- git 플러그인

- maven 플러그인

- sonar maven 빌드시 필요한 maven connector

2. database 설정 변경

- sonar-server 프로젝트가 웹서버를 가동시키는 프로젝트이다(packaging war)

- src/dev/mysql/conf/sonar.properties 에서 설정 변경 (설정을 변경하지 않고 sonar DB 에 sonar/sonar mysql user 를 생성하면 별 설정없이 사용가능하다)

mysql -uroot

mysql > create database sonar;

mysql > grant all privileges on sonar.* to sonar@localhost identified by 'sonar';

mysql > flush privileges;

3. jetty run

- 먼저 import 한 프로젝트를 local repository에  빌드한다. (install 시 skip test 를 선택하자. sonar 프로젝트를 빌드하는게 목적이다.)

[WARNING] Rule 3: org.apache.maven.plugins.enforcer.RequireMavenVersion failed with message:
To build this project Maven 3.0.5 (or upper) is required. Please install it.

-> eclipse kepler 의 내장 maven 버전은 3.04 이다. maven home page 에서 상위버전을 다운로드 받은후 eclipse maven 설정에서 기본 maven 을 변경한다.

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

-> Eclipse 설정에서 Istalled JREs -> JAVASE-1.7  -> jdk 로 변경(jre 로 선택되어있을경우 오류 발생)

- sonar-server 프로젝트에 maven 플러그인으로 org.mortbay.jetty 설정되어 있음을 볼수 있다.

- port 와 context는 적절하게 변경하고 jetty 를 실행해보자

- sonar-server -> Run As -> Maven build... -> clean jetty:run -Pstart-dev-server,mysql

- server 가 정상적으로 구동되면 sonar DB 에 table 과 기본 데이터가 세팅이 되어 있음을 확인할 수 있다.

- 서버 구동시에 OutOfMemory 가 발생시에는 서버 구동시 적절한 메모리 옵션을 주도록한다.

4. browser에서 확인

 - http://localhost:9000/dev/

- 기본계정 : admin/admin

 

블로그 이미지

비추마

,
새작업을 선택하면 다음과 같은 화면이 나온다.


1. 작업명 입력 (Bizuma Components) 
- 이미 등록되어 있는 작업과 같은 설정을 사용할 경우 기존 작업 복사를 선택한다.

2. Build a maven 2/3 project 선택 후 OK




작업 환경 설정

1. Svn을 사용할 경우 Source Code Management 섹션에서 Subversion을 선택



- Repository URL : svn 경로이다. (http://192.168.10.xxx/svn/bizuma/trunk/BizumaComponents
--Maven의 모듈 개념을 사용해서 그룹을 지정할 경우 BizumaComponents 의 루트에 pom.xml이 등록되어 있어야 한다.

--예를 들어 BizumaComponents에 BizumaEntity 와 BizumaProcess의 모듈이 등록외어 있다면 BizumaCompoents의 pom.xml에 <module> 로소 위 두개의 프로젝트가 등록되어 있다면 모듈에 선언한 순으로 허드슨 빌드 순서가 된다.

-- 허드슨 Maven 빌드시에 BizumaComponents에 pom.xml이 존재 하지 않느다면 빌드가 실패하게 된다. 

-- 자세한 사항은 Maven프로젝트 생성시 module개념을 알아야한다.
 

- Local module directory(optional) : 허드슨이 빌드시에 Check out 받을 로컬 저장경로 명이다. 해당 저장경로는 기입 하지 않아도 되지만 SVN 루트경로(지금은 BizumaComponents)로 지정해서 명확하게 해주는것을 추천하고 싶다.


 2. Build triggers 선택

- Cron Expression을 사용한 빌드를 할 경우 Build periodically를 선택.


- Schedule 입력란에 00 01 * * * 이라고 입력하면 매일 새벽 한시에 해당 컴포넌트를 빌드 하게 될 것이다.

- Cron Expression은 다른 자료를 참고 하도록 하자.

3. Build 섹션


- Root POM : pom.xml은 그냥 둔다. 만약 BizumaComponents에 pom,xml이 존재 하지 않는다면 허드슨 창에서 에러박스가 나게 된다.

- Goals and opeitons : clean deploy (메이븐 GOAL 등록)

4. Build Settings

- E-mail Notification : 해당사항을 체크 하고 Recipients를 입력하면 입력된 이매일로 매일을 전송하게 된다. (이매일 구분은 공백으로 한다.)



5. Post-build Actions


- 말그대로 BizumaConponents를 빌두 후에 할 작업을 등록하는 곳이다.

- Build other projects를 선택후 프로젝트를 입력하면 BizumaComponents를 빌드 후에 입력한 프로젝트 빌드를 수행한다.

블로그 이미지

비추마

,