Pax Exam在karaf lib / ext文件夹中复制一个jar

时间:2016-02-10 13:28:00

标签: osgi apache-karaf osgi-bundle karaf pax-exam

有没有办法在启动pax-exam时在karaf lib / ext文件夹中复制一个jar

@Configuration
    public static Option[] configuration() throws Exception {
        return new Option[] {
                karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf")
                        .type("zip").version("4.0.1"))
                .unpackDirectory(new File("target/paxexam/unpack/"))
                .useDeployFolder(false),
                KarafDistributionOption.debugConfiguration("8898", true),
                configureConsole().ignoreLocalConsole(),
                logLevel(LogLevel.INFO),
                keepRuntimeFolder(),

        };
    }

1 个答案:

答案 0 :(得分:1)

我找到了解决方案。以下代码将解决问题

@Configuration
    public static Option[] configuration() throws Exception {
        MavenUrlReference oracleLib = maven()
                .groupId("com.oracle")
                .artifactId("ojdbc6")
                .version("11.2.0")
                .type("jar");

        return new Option[] {
                karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf")
                        .type("zip").version("4.0.1"))
                .unpackDirectory(new File("target/paxexam/unpack/"))
                .useDeployFolder(false),
                KarafDistributionOption.debugConfiguration("8898", true),
                bootClasspathLibrary(oracleLib),
                configureConsole().ignoreLocalConsole(),
                logLevel(LogLevel.INFO),
                keepRuntimeFolder(),

        };
    }