2016-10-20 13 views
2

은 제가 받는다는 통해 참조 내 프로젝트에 많은 타사 항아리를 'BND-받는다는 - 플러그인' https://github.com/bndtools/bnd/tree/master/maven/bnd-maven-plugin'bnd-maven-plugin'을 사용하여 내 OSGi 번들 jar에 모든 타사 jar (해결 가능)를 추가하는 방법은 무엇입니까?

를 사용하여 OSGi 애플리케이션을 개발하고있다.

'maven install'을 사용하여 jar 번들을 생성 할 때 필자는 그것을 얻을 것이며 felix에 배포 할 때 다른 종속 타사 jar를 해결하지 못합니다. 그것은 '받는다는 - 번들 플러그인' 'BND-받는다는 - 플러그인'와 http://www.lucamasini.net/Home/osgi-with-felix/creating-osgi-bundles-of-your-maven-dependencies

POM 파일과 협력

는 아래에 주어진 하나 아래

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>XYZ.Models</groupId> 
    <artifactId>XYZ.Models</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <dependencies> 

     <dependency> 
      <groupId>org.apache.commons</groupId> 
      <artifactId>commons-lang3</artifactId> 
      <version>3.4</version> 
     </dependency> 


     <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> 
     <dependency> 
      <groupId>com.google.code.gson</groupId> 
      <artifactId>gson</artifactId> 
      <version>2.2.4</version> 
     </dependency> 

    </dependencies> 

    <build> 
     <sourceDirectory>src</sourceDirectory> 
     <plugins> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>biz.aQute.bnd</groupId> 
       <artifactId>bnd-maven-plugin</artifactId> 
       <version>3.2.0</version> 
       <executions> 
        <execution> 
         <goals> 
          <goal>bnd-process</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-jar-plugin</artifactId> 
       <version>3.0.0</version> 
       <configuration> 
        <archive> 

         <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> 
        </archive> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

가 '에 대한 POM을하고있다 받는다는 - 번들 플러그인 '

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>XYZ.Models</groupId> 
    <artifactId>XYZ.Models</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <dependencies> 

     <dependency> 
      <groupId>org.apache.commons</groupId> 
      <artifactId>commons-lang3</artifactId> 
      <version>3.4</version> 
      <scope>provided</scope> 
     </dependency> 


     <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> 
     <dependency> 
      <groupId>com.google.code.gson</groupId> 
      <artifactId>gson</artifactId> 
      <version>2.2.4</version> 
      <scope>provided</scope> 
     </dependency> 

    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <profiles> 
     <profile> 
      <id>create-osgi-bundles-from-dependencies</id> 
      <build> 
       <directory>${basedir}/bundles</directory> 
       <plugins> 

        <plugin> 
         <groupId>org.apache.felix</groupId> 
         <artifactId>maven-bundle-plugin</artifactId> 
         <version>2.0.1</version> 
         <extensions>true</extensions> 
         <executions> 
          <execution> 
           <id>wrap-my-dependency</id> 
           <goals> 
            <goal>wrap</goal> 
           </goals> 
           <configuration> 
            <wrapImportPackage>;</wrapImportPackage> 
           </configuration> 
          </execution> 
         </executions> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
    </profiles> 
</project> 
+0

여기에는 질문이없는 것 같습니다. –

+0

안녕하세요 @NeilBartlett 감사합니다. 'bnd-maven-plugin'과 관련된 쿼리를 게시 할 수있는 곳은 어디 까지나이 플러그인에 대한 설명 기사를 찾지 못했습니다. –

+1

그렇다면 * maven-bundle-plugin *을 사용하면 어떨까요? – stempler

답변

1

0의 마법은 기본적으로 생성 된 jar 파일의 모든 종속성을 자원으로 추가하고 번들 클래스 경로를 구성하는 <wrapImportPackage>;</wrapImportPackage>에 의해 수행됩니다.

bnd-maven-plugin POM의 지침을 사용하지 않습니다. 파일 bnd에서해야합니다. This tutorial은 Liferay 및 Gradle에만 적용되지만 -includeresource 명령어의 예와 번들 클래스 경로 설정 방법을 보여줍니다.