在花了一些时间尝试解决这个问题后,我找到了解决方案。因此,您需要将以下捆绑包安装到您的 Felix(使用 v.4.4.1 测试)中,以使 Aries 蓝图运行:
- org.apache.aries.blueprint:org.apache.aries.blueprint:1.1.0
- org.apache.aries:org.apache.aries.util:1.1.0
- org.apache.aries.proxy:org.apache.aries.proxy:1.0.1
- org.apache.felix:org.apache.felix.configadmin:1.8.0
- SLF4J 的一种实现(在这种情况下是 PAX 日志记录):
- org.ops4j.pax.logging:pax-logging-api:1.4
- org.ops4j.pax.logging : pax-logging-service : 1.4(你可以排除 log4j : log4j 因为不需要)
这些 jar 将启用 Felix 中的 Aries Blueprint(但仅限 XML 配置版本)。如果你想使用注解,你还必须添加注解相关的罐子。
这是一个可以减轻您的工作的pom。只需运行它,所有需要安装在 felix 中的 jar 都将在您的目标文件夹中。
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.aries</groupId>
<artifactId>blueprint-felix-assembly</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Blueprint Felix Jar Assembly</name>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<pax.logging.version>1.4</pax.logging.version>
<aries.version>1.1.0</aries.version>
<aries.proxy.version>1.0.1</aries.proxy.version>
<felix.config.admin.version>1.8.0</felix.config.admin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.configadmin</artifactId>
<version>${felix.config.admin.version}</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-api</artifactId>
<version>${pax.logging.version}</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-service</artifactId>
<version>${pax.logging.version}</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint</artifactId>
<version>${aries.version}</version>
</dependency>
<dependency>
<groupId>org.apache.aries</groupId>
<artifactId>org.apache.aries.util</artifactId>
<version>${aries.version}</version>
</dependency>
<dependency>
<groupId>org.apache.aries.proxy</groupId>
<artifactId>org.apache.aries.proxy</artifactId>
<version>${aries.proxy.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>