0

com.jcraft.jzlib -- Cannot be resolved

I need dependency and export package for this error. Can anyone give for that dependency and export package for this?

Gimby
  • 5,095
  • 2
  • 35
  • 47
shanmu
  • 31
  • 3
  • 11

2 Answers2

0

I could find only dependency relating to your group name in mvnrepo, so possibly you could be missing this dep

<dependency>
    <groupId>com.jcraft</groupId>
    <artifactId>jzlib</artifactId>
    <version>1.1.3</version>
</dependency>
kuhajeyan
  • 10,727
  • 10
  • 46
  • 71
  • i find now this dependency.but i coud not find export package in pom .xml,so can you find for that one? – shanmu Sep 09 '16 at 08:28
  • 1
    @shanmu I've used Maven for many years, but I have no idea what you mean by an "export package". – Gimby Sep 09 '16 at 13:07
0

What you have is a normal JAR and not a bundle, what you could do is wrap this jar into a custom bundle with relevant export statement. Host this bundle in your own repository (nexus, jfrog etc).

You can look at another post Convert existing JAR to OSGi-bundle for details on building custom bundle.

In case if you have multiple such 3rd party dependencies, then create a separate maven pom module to wrap all 3rd party dependencies. Then you could use the bundle generated from this project as dependency in modules that need 3rd party packages -

Sample 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>
Community
  • 1
  • 1
Ameesh Trikha
  • 1,652
  • 2
  • 12
  • 18