2011-09-15 10 views
8

मूल रूप से सकर्मक निर्भरता को छोड़ने के लिए नहीं कर पा रहे, अपने वेब सेवा के लिए एक एकल OSGi जार बंडल के रूप में परिनियोजन योग्य होना चाहिए। इसलिए:एम्बेडेड निर्भरताओं के साथ मेवेन में ओएसजीआई बंडल बनाने की कोशिश कर रहा है। BND classpath से

  1. बंडल में सभी संकलन और रनटाइम मैवेन निर्भरताएं होनी चाहिए।
  2. यह भी सभी गैर वैकल्पिक निर्भरता है कि उन निर्भरता (जैसे कि, सकर्मक निर्भरता) पर निर्भर होना चाहिए।

मैं यह पूरा करने के Maven गठरी-प्लगइन का उपयोग करने का प्रयास कर रहा हूँ। मैंने बंडल में अपनी सभी संकलन और रनटाइम निर्भरताओं को प्राप्त करने के लिए एम्बेड-निर्भरता का उपयोग किया है, और मैंने सभी ट्रांजिटिव निर्भरताओं को एम्बेड करने के लिए एम्बेड-ट्रांजिटिव का उपयोग किया है। मैंने तब पता लगाया कि बीएनडी क्लासपाथ से मेवेन निर्भरताओं को बाहर करने के लिए अलग-अलग निर्भरताओं का उपयोग कैसे किया जाए (वे मेनिफेस्ट में निजी-पैकेज में स्थानांतरित हो जाते हैं), लेकिन मेरे जीवन के लिए मैं यह नहीं समझ सकता कि इसे पारगमन निर्भरताओं को बाहर करने के लिए कैसे प्राप्त किया जाए । कोई फर्क नहीं पड़ता कि मैं क्या करता हूं, ट्रांजिटिव निर्भरता अभी भी प्रकट में पैकेज-आयात सूची में दिखाई देती है।

इससे भी बदतर, यह वैकल्पिक सहित सभी निर्भरता में चूसना करने के लिए तो मैं मैं ibatis और jfree तरह का प्रयोग नहीं करते अतिरिक्त सामान के बहुत सारे मिल रहा है। फिर भी, जब मैं जोड़ता हूं; वैकल्पिक = निर्भरता पैटर्न के लिए झूठा, मुझे एक चेतावनी मिलती है कि पैटर्न पर कोई निर्भरता मेल नहीं खाती है।

मैं एक एक करके लेकिन नीचे निर्भरता मैं वहाँ का फैसला किया है एक बेहतर तरीका होना था पीछा के एक घंटे के बाद निर्भरता को बाहर करने की कोशिश कर रहा शुरू कर दिया।

यह मेरा 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> 

<parent> 
    <artifactId>direct-parent</artifactId> 
    <groupId>com.edo.direct</groupId> 
    <version>1.0-SNAPSHOT</version> 
    <relativePath>../direct-parent</relativePath> 
</parent> 

<artifactId>direct-registration</artifactId> 
<packaging>bundle</packaging> 

<repositories> 
    <repository> 
     <id>wso2</id> 
     <url>http://dist.wso2.org/maven2/</url> 
    </repository> 
</repositories> 

<build> 
    <plugins> 

     <plugin> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>maven-bundle-plugin</artifactId> 
      <version>2.3.5</version> 
      <extensions>true</extensions> 
      <executions> 
       <execution> 
        <phase>package</phase> 
        <goals> 
         <goal>bundle</goal> 
        </goals> 
       </execution> 
      </executions> 
      <configuration> 
       <excludeDependencies>*;scope=compile|runtime</excludeDependencies> 
       <ignoreMissingArtifacts>true</ignoreMissingArtifacts> 
       <instructions> 
        <Bundle-Vendor>edo Interactive</Bundle-Vendor> 
        <Bundle-SymbolicName>com.edo.direct.service</Bundle-SymbolicName> 
        <Export-Package> 
         com.edo.service;-split-package:=merge-first 
        </Export-Package> 
        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> 
        <Embed-Transitive>true</Embed-Transitive> 
        <Import-Package> 
         * 
        </Import-Package> 
        <Private-Package> 
         com.edo*;-split-package:=merge-first, 
        </Private-Package> 
        <Include-Resource> 
         {maven-resources} 
        </Include-Resource> 
        <Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath> 
       </instructions> 
      </configuration> 
     </plugin> 

     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.9</version> 
      <configuration> 
       <includes> 
        <include>**/*Test.java</include> 
       </includes> 
      </configuration> 
     </plugin> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>build-helper-maven-plugin</artifactId> 
      <version>1.5</version> 
      <executions> 
       <execution> 
        <id>add-source</id> 
        <phase>generate-sources</phase> 
        <goals> 
         <goal>add-source</goal> 
        </goals> 
        <configuration> 
         <sources> 
          <source>src/main/groovy</source> 
         </sources> 
        </configuration> 
       </execution> 
       <execution> 
        <id>add-test-source</id> 
        <phase>generate-test-sources</phase> 
        <goals> 
         <goal>add-test-source</goal> 
        </goals> 
        <configuration> 
         <sources> 
          <source>src/test/groovy</source> 
         </sources> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.3.1</version> 
      <configuration> 
       <compilerId>groovy-eclipse-compiler</compilerId> 
       <verbose>true</verbose> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
      <dependencies> 
       <dependency> 
        <groupId>org.codehaus.groovy</groupId> 
        <artifactId>groovy-eclipse-batch</artifactId> 
        <version>1.8.0-03</version> 
       </dependency> 
       <dependency> 
        <groupId>org.codehaus.groovy</groupId> 
        <artifactId>groovy-eclipse-compiler</artifactId> 
        <version>2.5.1</version> 
        <exclusions> 
         <exclusion> 
          <groupId>org.codehaus.groovy</groupId> 
          <artifactId>groovy-eclipse-batch</artifactId> 
         </exclusion> 
        </exclusions> 
       </dependency> 
      </dependencies> 
     </plugin> 
    </plugins> 
    <pluginManagement> 
     <plugins> 
      <!--This plugin's configuration is used to store Eclipse m2e settings 
       only. It has no influence on the Maven build itself. --> 
      <plugin> 
       <groupId>org.eclipse.m2e</groupId> 
       <artifactId>lifecycle-mapping</artifactId> 
       <version>1.0.0</version> 
       <configuration> 
        <lifecycleMappingMetadata> 
         <pluginExecutions> 
          <pluginExecution> 
           <pluginExecutionFilter> 
            <groupId>org.codehaus.mojo</groupId> 
            <artifactId>build-helper-maven-plugin</artifactId> 
            <versionRange>[1.5,)</versionRange> 
            <goals> 
             <goal>add-source</goal> 
             <goal>add-test-source</goal> 
            </goals> 
           </pluginExecutionFilter> 
           <action> 
            <execute /> 
           </action> 
          </pluginExecution> 
          <pluginExecution> 
           <pluginExecutionFilter> 
            <groupId>org.apache.maven.plugins</groupId> 
            <artifactId>maven-compiler-plugin</artifactId> 
            <versionRange>[2.3.1,)</versionRange> 
            <goals> 
             <goal>testCompile</goal> 
             <goal>compile</goal> 
            </goals> 
           </pluginExecutionFilter> 
           <action> 
            <execute /> 
           </action> 
          </pluginExecution> 
          <pluginExecution> 
           <pluginExecutionFilter> 
            <groupId>org.codehaus.groovy</groupId> 
            <artifactId>groovy-eclipse-compiler</artifactId> 
            <versionRange>[2.5.1,)</versionRange> 
            <goals> 
             <goal>testCompile</goal> 
             <goal>compile</goal> 
            </goals> 
           </pluginExecutionFilter> 
           <action> 
            <execute /> 
           </action> 
          </pluginExecution> 
         </pluginExecutions> 
        </lifecycleMappingMetadata> 
       </configuration> 
      </plugin> 
     </plugins> 
    </pluginManagement> 
</build> 

<name>direct-registration</name> 
<url>http://maven.apache.org</url> 

<properties> 
    <gmaven.version>1.3</gmaven.version> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
</properties> 

<dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.9</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.axis2.wso2</groupId> 
     <artifactId>axis2</artifactId> 
     <version>1.6.0.wso2v4</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.axis2</groupId> 
     <artifactId>axis2-kernel</artifactId> 
     <version>1.6-wso2v4</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.axis2</groupId> 
     <artifactId>axis2</artifactId> 
     <version>1.6.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.axis2</groupId> 
     <artifactId>axis2-kernel</artifactId> 
     <version>1.6.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.axis2</groupId> 
     <artifactId>axis2-spring</artifactId> 
     <version>1.6.0</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-core</artifactId> 
     <version>3.0.5.RELEASE</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-beans</artifactId> 
     <version>3.0.5.RELEASE</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-orm</artifactId> 
     <version>3.0.5.RELEASE</version> 
     <scope>compile</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-web</artifactId> 
     <version>3.0.5.RELEASE</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-context</artifactId> 
     <version>3.0.5.RELEASE</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-webmvc</artifactId> 
     <version>3.0.5.RELEASE</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-asm</artifactId> 
     <version>3.0.5.RELEASE</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-config</artifactId> 
     <version>3.0.5.RELEASE</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-web</artifactId> 
     <version>3.0.5.RELEASE</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework.security</groupId> 
     <artifactId>spring-security-ldap</artifactId> 
     <version>3.0.5.RELEASE</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 

    <dependency> 
     <groupId>org.grails</groupId> 
     <artifactId>grails-spring</artifactId> 
     <version>1.3.7</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 

    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-validator</artifactId> 
     <version>4.2.0.Final</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-core</artifactId> 
     <version>3.6.5.Final</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-ehcache</artifactId> 
     <version>3.6.5.Final</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate.javax.persistence</groupId> 
     <artifactId>hibernate-jpa-2.0-api</artifactId> 
     <version>1.0.0.Final</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 

    <dependency> 
     <groupId>postgresql</groupId> 
     <artifactId>postgresql</artifactId> 
     <version>9.0-801.jdbc4</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>javassist</groupId> 
     <artifactId>javassist</artifactId> 
     <version>3.12.1.GA</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>cglib</groupId> 
     <artifactId>cglib</artifactId> 
     <version>2.2.2</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>net.sf.ehcache</groupId> 
     <artifactId>ehcache-core</artifactId> 
     <version>2.4.3</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 

    <dependency> 
     <groupId>com.google.collections</groupId> 
     <artifactId>google-collections</artifactId> 
     <version>1.0</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>commons-lang</groupId> 
     <artifactId>commons-lang</artifactId> 
     <version>2.6</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>commons-io</groupId> 
     <artifactId>commons-io</artifactId> 
     <version>2.0.1</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>commons-codec</groupId> 
     <artifactId>commons-codec</artifactId> 
     <version>1.5</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>joda-time</groupId> 
     <artifactId>joda-time</artifactId> 
     <version>1.6.2</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 

    <dependency> 
     <groupId>commons-logging</groupId> 
     <artifactId>commons-logging</artifactId> 
     <version>1.1.1</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-api</artifactId> 
     <version>1.5.10</version> 
     <scope>compile</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>slf4j-log4j12</artifactId> 
     <version>1.5.10</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>jcl-over-slf4j</artifactId> 
     <version>1.5.10</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>org.slf4j</groupId> 
     <artifactId>jul-to-slf4j</artifactId> 
     <version>1.5.10</version> 
     <scope>runtime</scope> 
     <optional>false</optional> 
    </dependency> 
    <dependency> 
     <groupId>log4j</groupId> 
     <artifactId>log4j</artifactId> 
     <version>1.2.16</version> 
     <scope>provided</scope> 
    </dependency> 

    <dependency> 
     <groupId>org.apache.geronimo.specs</groupId> 
     <artifactId>geronimo-osgi-locator</artifactId> 
     <version>1.1</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.geronimo.specs</groupId> 
     <artifactId>geronimo-jaxrs_1.1_spec</artifactId> 
     <version>1.0</version> 
     <scope>provided</scope> 
    </dependency> 
    <dependency> 
     <groupId>javax.servlet</groupId> 
     <artifactId>servlet-api</artifactId> 
     <version>2.5</version> 
     <scope>provided</scope> 
    </dependency> 

    <!-- Project Dependencies --> 
    <dependency> 
     <groupId>${project.groupId}</groupId> 
     <artifactId>direct-common</artifactId> 
     <version>${project.version}</version> 
    </dependency> 
</dependencies> 
</project> 

उत्तर

3

मुझे इसी तरह की समस्या थी, मैं टाइको बिल्ड का उपयोग करता हूं, लेकिन मेरे बंडलों में से एक बीएनडी के साथ बनाया गया है। http://code.google.com/p/choncms/source/browse/trunk/chon-platform/bnd-libs/pom.xml देखें, आयात-पैकेज में मैं उपयोग कर रहा हूं! * सभी निर्भरताओं को बाहर करने के लिए जो आवश्यक है उसे छोड़कर स्पष्ट रूप से उल्लेख किया गया है।

+1

आजकल लिंक मान्य नहीं है - क्या कोई इसे रीफ्रेश कर सकता है? –

संबंधित मुद्दे