1

コンパイル スコープを持つ sesame-runtime-osgi 依存関係を含む OSGi プロジェクトがあります。

<dependency>
    <groupId>org.openrdf.sesame</groupId>
    <artifactId>sesame-runtime-osgi</artifactId>
    <version>${sesame.version}</version>
    <exclusions>
        <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </exclusion>
    </exclusions>
</dependency>

sesame-runtime-osgi アーティファクトには、いくつかのランタイム依存関係が含まれています。例えば:

+- org.openrdf.sesame:sesame-runtime-osgi:jar:2.7.13:compile
|  +- org.openrdf.sesame:sesame-http-client:jar:2.7.13:compile
|  |  +- org.openrdf.sesame:sesame-http-protocol:jar:2.7.13:compile
|  |  |  \- org.openrdf.sesame:sesame-rio-ntriples:jar:2.7.6:compile
|  |  |     \- commons-io:commons-io:jar:2.1:compile
|  |  +- org.openrdf.sesame:sesame-query:jar:2.7.13:compile
.
.
.
|  |  \- commons-codec:commons-codec:jar:1.4:runtime
|  \- org.openrdf.sesame:sesame-http-server-spring:jar:2.7.13:compile
|     +- org.openrdf.sesame:sesame-runtime:jar:2.7.6:compile
|     |  +- org.openrdf.sesame:sesame-repository-manager:jar:2.7.13:compile
.
.
.
|     |  +- org.openrdf.sesame:sesame-queryresultio-sparqljson:jar:2.7.13:runtime
|     |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.2.2:runtime
|     |  +- org.openrdf.sesame:sesame-queryresultio-text:jar:2.7.13:runtime
|     |  |  \- net.sf.opencsv:opencsv:jar:2.0:runtime
.
.
.
|     \- cglib:cglib:jar:2.2:compile
|        \- asm:asm:jar:3.1:compile

「net.sf.opencsv:opencsv:jar:2.0」はランタイムの依存関係であるため、karaf-maven-plugin によって生成された feature.xml には含まれていません。残念ながら、実行時に必要なパッケージは、sesame-runtime-osgi マニフェストの「Import-Packages」ディレクティブに含まれています

Import-Package: au.com.bytecode.opencsv

そのため、ランタイムの依存関係を自分で手動でラップして展開しない限り、Karaf は機能を展開できません。明らかに、私はそれをする必要はありません。

feature.xml 生成にランタイム スコープの依存関係を含める方法はありますか?

ありがとう

4

2 に答える 2

1

標準の Karaf mojo を使用して features.xml を生成している場合は、src/main/features/features.xml に機能テンプレート ファイルを作成できます。そのテンプレートに入力したものは、最終的に生成された features.xml に表示されます。必要に応じて、ランタイムの依存関係をテンプレートにハードコーディングできます。

pom で各推移的な依存関係を手動で指定できます。それもおそらくうまくいくでしょうか?

于 2015-02-04T22:55:14.943 に答える
0

リチャードの答えをフォローアップするために、テンプレートファイルは次の場所にある必要があります

src/main/feature/feature.xml

いいえ

src/main/features/features.xml

feature.xml テンプレート ファイル内には、生成されたものとマージされる依存関係バンドルと機能を含めることができます。例えば。

<?xml version="1.0" encoding="UTF-8"?>
<features name="${project.artifactId}-${project.version}">
  <feature name="${project.artifactId}" description="${project.name}" version="${project.version}">
    <bundle>mvn:net.sf.opencsv/opencsv/2.0</bundle>
  </feature>
</features>
于 2016-01-22T15:14:55.623 に答える