2011-06-24 14 views
0

私はMavenプロジェクトをうまく構築していますが、私はtwitter4jへの参照を追加しようとしています。maven-bundle-pluginを使用したエラー埋め込み依存

だから私はPOMにこれを追加します。

<dependency> 
     <groupId>org.twitter4j</groupId> 
     <artifactId>twitter4j-core</artifactId> 
     <version>[2.2,)</version> 
     <type>jar</type> 
     <optional>false</optional> 
     <scope>compile</scope> 
    </dependency> 

私は(MVNクリーンインストール)を構築すると私が取得:

[ERROR] Error building bundle net.stevex.tweetfetcher:tweetfetcher-bundle:bundle:1.0-SNAPSHOT : Unresolved references to [twitter4j] by class(es) on the Bundle-Classpath[Jar:dot]: [net/stevex/tweetfetcher/impl/TweetFetcherImpl.class] 

これは理にかなって... twitter4jパッケージが中に埋め込まれていませんバンドル。

<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> 

そして、私が構築したときに、今、私が手::だから私は、Mavenのバンドル・プラグインの指示に埋め込み、依存関係を追加

[ERROR] Error building bundle net.stevex.tweetfetcher:tweetfetcher-bundle:bundle:1.0-SNAPSHOT : Unresolved references to [dalvik.system, javax.crypto, javax.crypto.spec, javax.management, javax.management.openmbean, org.apache.commons.logging, org.apache.log4j, org.slf4j.impl, twitter4j.internal.http.alternative] by class(es) on the Bundle-Classpath[Jar:dot, Jar:twitter4j-core-2.2.3.jar]: [twitter4j/internal/logging/CommonsLoggingLogger.class, twitter4j/internal/logging/Log4JLoggerFactory.class, twitter4j/auth/OAuthToken.class, twitter4j/internal/http/HttpClientFactory.class, twitter4j/auth/OAuthAuthorization.class, twitter4j/internal/logging/Log4JLogger.class, twitter4j/conf/ConfigurationBase.class, twitter4j/TwitterAPIMonitor.class, twitter4j/internal/logging/CommonsLoggingLoggerFactory.class, twitter4j/management/APIStatisticsOpenMBean.class, twitter4j/internal/logging/Logger.class] 

twitter4jクラスが欠落している理由を私は理解していません、私はdalvik.system、javax.cryptoなどへの参照を理解していません。何が間違っていますか?

答えて

3

問題は、twitter4jプロジェクトでは、エラーリストにリストされているすべてのパッケージが必要になることです。これを使用すると、推移的な依存関係はすべて含まれません。敗北のこの種のOSGiの目的、しかし、すべての推移的依存関係

<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> 
<Embed-Transitive>true</Embed-Transitive> 

を埋め込みますMavenのバンドル・プラグインの埋め込み推移命令があります。 SpringSource EBR第二中のパッケージの

  1. 検索:これは私の知っている二つのオプションであなたを残します。検索ボックスにパッケージ名を入力するだけで、結果にPOMファイルのxmlが含まれます。 SpringSourceバンドルには、EBR内の他のバンドルへの参照が含まれるため、推移的な依存関係の問題は解決されます。

  2. maven-bundle-pluginのbundle-allゴールを使用します。この目標は、プロジェクトのすべての依存関係に対してmavenバンドルプラグインを実行し、結果のバンドルをターゲットディレクトリに配置します。これらのバンドルをローカルリポジトリにインストールすることができます。

あなたが見つけることができるように私はSpringSourceのはそれらを持っていない場合、オプション2をデフォルト、バンドルの多くのためのオプション1を使用することをお勧めします。

+1

twitter4jが探していたパッケージは不要なので、import-packageにimportステートメントを追加しました。オプションとしてマークされています:twitter4j.internal.http.alternative; resolution:= optional(など)。 – stevex

関連する問題