0

I have a OSGi project and I am using Maven. In a bundle I need to import org.osgi.util.tracker.ServiceTracker, but for some inexplicable reason Netbeans keep telling me that package org.osgi.util.tracker does not exist. But it does. See this screenshot:

enter image description here

I clearly have felix framework in my dependencies. It does exist on my hard drive, its path is set correctly. I can unzip the jar and navigate to the very class I want to import which really is in the appropriate package (as seen in the folder tree).

What the hell is happening? :(

Edit: Business's pom.xml is this:

<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>library-parent</artifactId>
        <groupId>org.lib</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>

    <groupId>org.lib</groupId>
    <artifactId>business</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>bundle</packaging>

    <name>business OSGi Bundle</name>

    <dependencies>   
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.osgi.core</artifactId>        
        </dependency>   
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>model</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>integration</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>utils</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework</artifactId>
            <version>4.2.1</version>
            <type>jar</type>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.7</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-Activator>org.lib.business.BusinessActivator</Bundle-Activator>
                        <Export-Package >org.lib.business</Export-Package>
                        <Private-Package>org.lib.business.*</Private-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
Martin Melka
  • 7,177
  • 16
  • 79
  • 138

0 Answers0