我有一個構建良好的Maven項目,我試圖添加對twitter4j的引用。使用maven-bundle-plugin的錯誤Embed-Dependency
所以我將其添加到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包未嵌入捆綁。所以,我想補充一個嵌入的依賴於Maven的捆插件的說明:
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
,現在當我建,我得到:
[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等的引用。這裏有什麼問題?
twitter4j尋找的包不是必需的,所以我將import語句添加到Import-Package中,並將它們標記爲可選:twitter4j.internal.http.alternative; resolution:= optional(etc)。 – stevex