com.jcraft.jzlib - 无法解决
我需要针对此错误的依赖项和导出包。任何人都可以为此提供依赖和导出包吗?
答案 0 :(得分:0)
我只能在mvnrepo中找到与您的群组名称相关的依赖关系,因此您可能会错过这个dep
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<version>1.1.3</version>
</dependency>
答案 1 :(得分:0)
你拥有的是普通的JAR而不是捆绑包,你可以做的是将这个jar包装成一个带有相关导出语句的自定义包。在您自己的存储库(nexus,jfrog等)中托管此捆绑包。
您可以查看其他帖子Convert existing JAR to OSGi-bundle,了解有关构建自定义捆绑包的详细信息。
如果你有多个这样的第三方依赖项,那么创建一个单独的maven pom模块来包装所有第三方依赖项。然后,您可以使用从此项目生成的包作为需要第三方包的模块中的依赖项 -
样本POM -
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>com.myproject.dependencies</artifactId>
<packaging>bundle</packaging>
<name>Third Party Dependencies</name>
<description>
This project manages dependencies needed by Project bundles.
</description>
<parent>
<groupId>com.myproject.parent</groupId>
<artifactId><!--PARENT ARTIFACT ID --></artifactId>
<version><!--PARENT VERSION --></version>
</parent>
<properties>
<!-- Any properties needed -->
</properties>
<dependencies>
<!-- 3rd party dependencies | List all 3rd parties as dependencies-->
<!-- https://mvnrepository.com/artifact/com.jcraft/jzlib -->
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<version>1.1.3</version>
</dependency>
</dependencies>
<!-- for packaging as an OSGi bundle, we use the maven-bundle-plugin -->
<!-- see http://felix.apache.org/site/maven-bundle-plugin-bnd.html for more info -->
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>
com.myproject.dependencies.*,
com.jcraft.*
</Export-Package>
<Private-Package>
<!-- Specify any private package here-->
</Private-Package>
<Import-Package>
*
</Import-Package>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Activator>${project.artifactId}.Activator</Bundle-Activator>
<Include-Resource>
{maven-resources}
</Include-Resource>
<Embed-Dependency>
jzlib
<!-- comma separated list of dependency artifact ids -->
</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<executions>
<execution>
<id>generate-scr-scrdescriptor</id>
<goals>
<goal>scr</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- generate manifest automatically once the classes are processed -->
</plugins>
</build>
</project>