티스토리 뷰

Apache Karaf를 기반으로 OSGi를 개발할 경우, 사용자가 개발하는 번들이 외부 라이브러리에 의존성을 가지게 되는 경우가 많다.

이런 경우, 외부 의존성을 해결 하기 위해 pom.xml에 의존성을 가지는 라이브러리 또는 패키지를 추가함으로써 해결 할 수 있다.

예를 들어, 다음과 같이 설정할 수 있다.  

...


<dependency>
<groupId>edu.stanford.protege</groupId>
<artifactId>code-generation</artifactId>
<version>2.0.0</version>
</dependency>


...


문제는 이후, 개발된 번들을 배포하기 위해서는 dependency가 선언된 패키지들을 같이 배포를 해주어야한다.

배포하는 사이트에서는 bundle과 관련된 정보 및 패키지 바이너리들이 존재 하지 않기 때문이다.

따라서 개발된 번들을 정상적으로 실행시키기 위해서는 개발된 번들이 요구하는 외부 패키지들 또한 bundle형태로 같이 제공해야 한다.

이 과정은 feature.xml 파일을 통해서 할 수 있다. 


이 상황에서 외부 라이브러리가 또 다른 외부 라이브러리에 의존성을 가질 수 있고... 

그 모든 패키지를 수동으로 찾아서 추가하는것은 굉장히 인내가 필요한 작업이다.


이 작업을 쉽게 할 수 있는 팁은 다음과 같다.

pom.xml파일에 다음을 추가하자.


<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>3.0.5</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>


그리고 아래 명령을 실행하면 된다. 

mvn karaf:features-generate-descriptor

그러면 /target/feature/feature.xml이 생성된다. 

그 안에 있는 내용을 카피하여, feature.xml에 추가하면 된다.

이 때, 중복적으로 선언되는 패키지가 있을 수 있으니 그부분을 수동으로 제거해주면 된다.


다음은 그렇게 생성하여 찾아낸 외부 패키지 이다. 


<bundle>wrap:mvn:com.github.ansell.pellet/pellet-owlapiv3/2.3.6-ansell</bundle>
<bundle>wrap:mvn:com.github.ansell.owlapi/owlapi-api/3.4.9.2-ansell</bundle>
<bundle>wrap:mvn:com.github.ansell.abstract-service-loader/abstract-service-loader/0.4</bundle>
<bundle>wrap:mvn:org.openrdf.sesame/sesame-model/2.7.8</bundle>
<bundle>wrap:mvn:org.openrdf.sesame/sesame-rio-api/2.7.8</bundle>
<bundle>wrap:mvn:com.github.ansell.owlapi/owlapi-impl/3.4.9.2-ansell</bundle>
<bundle>wrap:mvn:com.github.ansell.owlapi/owlapi-parsers/3.4.9.2-ansell</bundle>
<bundle>wrap:mvn:com.github.ansell.owlapi/owlapi-tools/3.4.9.2-ansell</bundle>
<bundle>wrap:mvn:com.github.ansell.pellet/pellet-core/2.3.6-ansell</bundle>
<bundle>wrap:mvn:com.github.ansell.pellet/pellet-common/2.3.6-ansell</bundle>
<bundle>wrap:mvn:com.github.ansell.aterms/aterm-java/1.8.2-p1</bundle>
<bundle>wrap:mvn:com.github.ansell.jjtraveler/jjtraveler/0.6</bundle>
<bundle>wrap:mvn:com.github.ansell.aterms/shared-objects/1.4.9-p1</bundle>
<bundle>wrap:mvn:org.jgrapht/jgrapht-jdk1.5/0.7.3</bundle>
<bundle>wrap:mvn:msv/xsdlib/20030225</bundle>
<bundle>wrap:mvn:msv/relaxngDatatype/20030225</bundle>
<bundle>wrap:mvn:xerces/xercesImpl/2.10.0</bundle>
<bundle>wrap:mvn:xml-apis/xml-apis/1.4.01</bundle>
<bundle>wrap:mvn:com.hp.hpl.jena/jena/2.6.4</bundle>
<bundle>wrap:mvn:com.ibm.icu/icu4j/3.4.4</bundle>
<bundle>wrap:mvn:com.github.ansell.pellet/pellet-query/2.3.6-ansell</bundle>
<bundle>wrap:mvn:com.hp.hpl.jena/arq/2.8.7</bundle>
<bundle>wrap:mvn:com.hp.hpl.jena/iri/0.8</bundle>
<bundle>wrap:mvn:org.codehaus.woodstox/wstx-asl/3.2.9</bundle>
<bundle>wrap:mvn:stax/stax-api/1.0.1</bundle>
<bundle>wrap:mvn:org.apache.lucene/lucene-core/2.3.1</bundle>
<bundle>wrap:mvn:com.github.ansell.pellet/pellet-jena/2.3.6-ansell</bundle>
<bundle>wrap:mvn:org.antlr/antlr-runtime/3.4</bundle>
<bundle>wrap:mvn:org.antlr/stringtemplate/3.2.1</bundle>
<bundle>wrap:mvn:antlr/antlr/2.7.7</bundle>
<bundle>wrap:mvn:org.kohsuke.metainf-services/metainf-services/1.4</bundle>


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   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