我想在我的項目中使用HttpClient。缺少需求osgi.wiring.package; (osgi.wiring.package = org.apache.http)
的pom.xml
.............
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient-osgi</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.4</version>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<_wab>src/main/webapp/</_wab>
<Bundle-SymbolicName>
${project.groupId}.${project.artifactId}
</Bundle-SymbolicName>
<Import-Package>
*,!com.google.gson
</Import-Package>
<Embed-Dependency>gson</Embed-Dependency>
<Export-Package>
org.apache.http.HttpEntity
</Export-Package>
<Web-ContextPath>${web.context}</Web-ContextPath>
</instructions>
</configuration>
</plugin>
..................
錯誤消息:
java.lang.IllegalStateException: Can't install feature test/0.0.0: Could not start bundle mvn:ttt/test/1.0-SNAPSHOT in feature(s) test-1.0-SNAPSHOT: Unresolved constraint in bundle ttt.test [234]: Unable to resolve 234.0: missing requirement [234.0] osgi.wiring.package; (osgi.wiring.package=org.apache.http)
我想有在 「構築」 一些錯誤,但我沒有任何想法來解決。
這可能是正確答案,但請添加更多細節以進一步闡明它。 –