2013-10-09 2 views
1
은 pom.xml 파일 받는다는 설명과 전쟁 구조를 만들 받는다는를 사용하여 프로젝트 ( 처녀 자리 서버로 배포) 간단한 OSGI를 만들 수있는 가장 좋은 방법은 무엇

? 내가 프로젝트를 만들 때메이븐 웹 프로젝트

구조 대상이 그런

*.jsp 
*.html 
META-INF 
MANIFEST (OSGI-CONFIG) 
WEB-INF 
    classes 
    lib 
    web.xml 

입니다

이 내 pom.xml 파일

프로젝트 속성이다

<groupId>com.aaaa</groupId> 
<artifactId>first-maven-virgo-project</artifactId> 
<version>1.0.0</version> 
<packaging>war</packaging> 

펠릭스 플러그인

<plugin> 
    <groupId>org.apache.felix</groupId> 
    <artifactId>maven-bundle-plugin</artifactId> 
    <extensions>true</extensions> 
    <configuration> 
     <supportedProjectTypes> 
      <supportedProjectType>war</supportedProjectType> 
     </supportedProjectTypes> 
     <instructions> 
      <Export-Package>com.roshka.servlet</Export-Package> 
      <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> 
      <Bundle-ClassPath>.,WEB-INF/classes,{maven-dependencies}</Bundle-ClassPath> 
      <Embed-Directory>WEB-INF/lib</Embed-Directory> 
      <Embed-Dependency>*;scope=compile|runtime;</Embed-Dependency> 
      <Embed-Transitive>true</Embed-Transitive> 
      <Web-ContextPath>/hello</Web-ContextPath> 
      <Webapp-Context>hello</Webapp-Context> 
     </instructions> 
    </configuration> 
</plugin> 

그러나 mvn install을 실행하면 패키지가 MANIFEST 파일을 만들지 않고 METAINF 폴더에 패키지됩니다.

펠릭스 프로젝트에 무슨 문제가 있습니까? OSGI BUNDLE과 WAR OSGI BUNDLE을 만드는 전형적인 pom.xml 템플릿은 무엇입니까?

p.s. 내가 바꾼다면 WAR에서 BUNDLE을 패키징 Maven 서술자로 변경하면 생성 된 JAR은 MANIFEST가 OK를 생성하여 OK로 동작한다. 그러나 그것은 WEB 구조가 아닙니다.

+0

도움을 주신 Brad – jrey

답변

1

내 질문은 단계별로 프로세스 단계를 설명 here를 찾을 수 IBM에서 응답이 다음의 pom.xml

<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>com.aaaa</groupId> 
<artifactId>first-maven-virgo-project</artifactId> 
<version>1.0.0</version> 
<packaging>war</packaging> 

<description>http://localhost:8090/system/console/bundles</description> 

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
</properties> 

<dependencies> 

    <dependency> 
     <groupId>commons-lang</groupId> 
     <artifactId>commons-lang</artifactId> 
     <version>2.6</version> 
    </dependency> 

    <dependency> 
     <groupId>org.apache.tomcat</groupId> 
     <artifactId>tomcat-servlet-api</artifactId> 
     <version>7.0.42</version> 
     <scope>provided</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.osgi</groupId> 
     <artifactId>org.osgi.core</artifactId> 
     <version>4.2.0</version> 
     <scope>provided</scope> 
    </dependency> 

</dependencies> 
<build> 
    <plugins> 

     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-war-plugin</artifactId> 
      <configuration> 
       <archive> 
        <manifestFile>./src/main/webapp/META-INF/MANIFEST.MF</manifestFile> 
       </archive> 
      </configuration> 
     </plugin> 

     <plugin> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>maven-bundle-plugin</artifactId> 
      <extensions>true</extensions> 
      <executions> 
       <execution> 
        <id>bundle-manifest</id> 
        <phase>process-classes</phase> 
        <goals> 
         <goal>manifest</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <supportedProjectTypes> 
        <supportedProjectType>war</supportedProjectType> 
       </supportedProjectTypes> 
       <manifestLocation>./src/main/webapp/META-INF</manifestLocation> 
       <instructions> 
        <Export-Package>com.roshka.servlet</Export-Package> 
        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> 
        <Bundle-ClassPath>.,WEB-INF/classes,{maven-dependencies}</Bundle-ClassPath> 
        <Embed-Directory>WEB-INF/lib</Embed-Directory> 
        <Embed-Dependency>*;scope=compile|runtime;</Embed-Dependency> 
        <Embed-Transitive>true</Embed-Transitive> 
        <Web-ContextPath>/hello</Web-ContextPath> 
        <Webapp-Context>hello</Webapp-Context> 
       </instructions> 
      </configuration> 
     </plugin> 

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-dependency-plugin</artifactId> 
      <executions> 
       <execution> 

        <id>copy-dependencies</id> 
        <phase>package</phase> 
        <goals> 
         <goal>copy-dependencies</goal> 
        </goals> 
        <configuration> 
         <Import-Package>javax.servlet,javax.servlet.http,javax.servlet.*,javax.servlet.jsp.*,javax.servlet.jsp.jstl.*,*</Import-Package> 
         <outputDirectory>./src/main/resources/WEB-INF/lib</outputDirectory> 
         <overWriteReleases>false</overWriteReleases> 
         <overWriteSnapshots>false</overWriteSnapshots> 
         <overWriteIfNewer>true</overWriteIfNewer> 
         <actTransitively>true</actTransitively> 
         <excludeScope>provided</excludeScope> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <!-- Enable this plugin for all modules --> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>maven-bundle-plugin</artifactId> 
     </plugin> 
    </plugins> 
</build> 

0

으로 해결하고있다. 전쟁이 주어진다면 번들을 생성하기 위해 스크립트를 개발할 수 있습니다. 빌드 단계로 호출 된 자바로 작성한 스크립트를 작성했습니다.

중요한 차이점은 IBM 단계는 완성 된 제품을 jar로두고 반면 jrey는 war 파일로 남겨 둡니다. 이것은 아마도 IBM 단계가 CICS 번들로 이어질 수 있기 때문일 것입니다. 적어도 RAD 환경을 사용할 때는 jar가 필요하다는 것을 알고 있습니다.

관련 문제