使用mvn pax-provision解决传递依赖性

时间:2012-10-10 07:15:05

标签: maven osgi equinox apache-felix pax

这是我父母的部分内容:

<plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.7</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>    
                            <goal>manifest</goal>
                        </goals>   
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.ops4j</groupId>
                <artifactId>maven-pax-plugin</artifactId>
                <version>1.4</version>
            </plugin>
               .
               .
               .   
<modules>
    <module>cross-annotations</module>
    <module>cross-main</module>
    <module>cross-event</module>
    <module>cross-exception</module>
    <module>cross-ui</module>
    <module>cross-tools</module>
    <module>cross-main-api</module>
    <module>cross-math</module>
</modules>
<dependencies>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.6.1</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.6.1</version>
        <scope>test</scope>
    </dependency>
    <dependency> 
        <groupId>org.projectlombok</groupId> 
        <artifactId>lombok</artifactId> 
        <version>0.10.6</version>
        <scope>provided</scope> 
    </dependency>
    <dependency>
        <groupId>org.netbeans.api</groupId>
        <artifactId>org-openide-util-lookup</artifactId>
        <version>RELEASE71</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>1.6.1</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jul-to-slf4j</artifactId>
        <version>1.6.1</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.felix</groupId>
        <artifactId>org.osgi.core</artifactId>
        <version>1.0.0</version>
        <!-- this is provisional, eventually, osgi.core should be provided by the runtime container -->
        <scope>provided</scope>
    </dependency>
</dependencies>

当我使用mvn pax运行时:我会收到类似

的错误
org.osgi.framework.BundleException: Unresolved constraint in bundle cross-annotations [4]: Unable to resolve 4.0: missing requirement [4.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j)(version>=1.6.0)(!(version>=2.0.0))) [caused by: Unable to resolve 1.0: missing requirement [1.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j.impl)(version>=1.6.0))]g! 

Unresolved constraint in bundle cross-ui [21]: Unable to resolve 21.0: missing requirement [21.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.configuration)(version>=1.6.0)(!(version>=2.0.0))) [caused by: Unable to resolve 9.0: missing requirement [9.0] osgi.wiring.package; (osgi.wiring.package=javax.mail.internet)]

当然抛出异常是因为OSGi容器中没有安装所需的需求,但我认为这是pax:provision的目的。

因此,正是我的问题:是否可以使用pax工具或任何其他mvn插件自动解析OSGi依赖项?

0 个答案:

没有答案