Unresolved references to [org.osgi.service.component]


hi,

 

i'm trying create bundle using maven-bundle-plugin. pom.xml of project is:

 

<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>

    <groupid>com.adobe.support.examples</groupid>

    <artifactid>com.adobe.support.examples.osgi.service</artifactid>

    <version>1.0.8</version>

    <packaging>bundle</packaging>

    <name>osgi service example</name>

    <url>http://blogs.adobe.com/kmossman</url>

    <description>adobe developer support osgi service example</description>

    <!-- 

    credit: example based on moritz havelock's http://in-the-sling.blogspot.com/

    

    suggest use current versions of plugin's.

    search central repository current versions http://search.maven.org/

    

    use search strings below , update appropriate versions

    

    // felix

    g:"org.apache.felix" a:"org.apache.felix.framework"

    g:"org.apache.felix" a:"maven-bundle-plugin"

    g:"org.apache.felix" a:"maven-scr-plugin"

    g:"org.apache.felix" a:"org.osgi.core"

    // maven

    g:"org.apache.maven.plugins" a:"maven-compiler-plugin" 

    // sling

    g:"org.apache.sling" a:"maven-sling-plugin"

    -->

    <properties>

        <project.build.sourceencoding>utf-8</project.build.sourceencoding>

        <project.build.java.version>1.6</project.build.java.version>

        <!-- felix -->

        <org.apache.felix.framework.version>4.0.2</org.apache.felix.framework.version>

        <org.apache.felix.maven-bundle-plugin.version>2.3.7</org.apache.felix.maven-bundle-plugin .version>   

        <org.apache.felix.maven-src-plugin.version>1.7.4</org.apache.felix.maven-src-plugin.versi on>

        <org.apache.felix.org.osgi.core>1.4.0</org.apache.felix.org.osgi.core>

        <!-- maven -->

        <org.apache.maven.plugins.maven-compiler-plugin.version>2.3.2</org.apache.maven.plugins.m aven-compiler-plugin.version>

        <org.apache.maven.plugins.maven-surefire-plugin.version>2.12</org.apache.maven.plugins.ma ven-surefire-plugin.version>

        <!-- sling -->

        <org.apache.sling.maven-sling-plugin.version>2.1.0</org.apache.sling.maven-sling-plugin.v ersion>

    </properties>

    <build>

    

        <plugins>

            <!--  maven compile our source java classes using

             "project.build.java.version" specified -->

            <plugin>

                <groupid>org.apache.maven.plugins</groupid>

                <artifactid>maven-compiler-plugin</artifactid>

                <version>${org.apache.maven.plugins.maven-compiler-plugin.version}</version>

                <configuration>

                  <source>${project.build.java.version}</source>

                  <target>${project.build.java.version}</target>

                </configuration>

            </plugin>

            <!--  install osgi bundle sling

            upload jar file automatically when build plug-in -->

            <plugin>

                <groupid>org.apache.sling</groupid>

                <artifactid>maven-sling-plugin</artifactid>

                <version>${org.apache.sling.maven-sling-plugin.version}</version>

                <executions>

                    <execution>

                        <id>install-bundle</id>

                        <goals>

                            <goal>install</goal>

                        </goals>

                        <configuration>

                            <slingurl>http://localhost:4502/system/console/install</slingurl>

                            <user>admin</user>

                            <password>admin</password>

                        </configuration>

                    </execution>

                </executions>

            </plugin>

            <plugin>

                <!-- create osgi-inf handles activator class us

                auto-generate details in our bundle plug-in-->

                <groupid>org.apache.felix</groupid>

                <artifactid>maven-scr-plugin</artifactid>

                <extensions>true</extensions>

                <version>${org.apache.felix.maven-src-plugin.version}</version>

                <executions>

                    <execution>

                        <id>generate-scr-scrdescriptor</id>

                        <goals>

                            <goal>scr</goal>

                        </goals>

                    </execution>

                </executions>

            </plugin>        

            <plugin>

                <!-- create osgi /meta-inf/manifest.mf us

                auto-generated filea plug-in -->

                <groupid>org.apache.felix</groupid>

                <artifactid>maven-bundle-plugin</artifactid>

                <extensions>true</extensions>

                <version>${org.apache.felix.maven-bundle-plugin.version}</version>

                <configuration>

                    <instructions>

                        <export-package>com.adobe.support.examples.osgi.service</export-package>

                        <import-package>org.osgi.framework;version="1.3.0"</import-package>

                        <bundle-symbolicname>${project.artifactid}</bundle-symbolicname>

                        <bundle-name>${project.name}</bundle-name>

                        <bundle-vendor>kurt mossman</bundle-vendor>

                        <!--

                            inserting content jcr , installing files on server bundle.

                        

                            sling-initial-content

                            

                                first line overwrite contents of node @ content/osgitest test.json

                                note: uninstall:=false says not remove content when remove package.

                                    set true remove content when package removed choice yours.

                                

                                second line overwrite path install files , overwrite them if re-install.

                         -->

                        <sling-initial-content>

                            sling-inf/initial-content/content/osgitest;path:=/content/osgitest;overwrite:=true;uninst all:=false,

                            sling-inf/initial-content/apps/samples/osgitest;path:=/apps/samples/osgitest;overwrite:=t rue;uninstall:=true

                        </sling-initial-content>

                    </instructions>

                </configuration>

            </plugin>

            <!--  use surefire plugin run test cases

            use thread count of 4 increase performance of test time. -->

            <plugin>

               <groupid>org.apache.maven.plugins</groupid>

               <artifactid>maven-surefire-plugin</artifactid>

               <version>${org.apache.maven.plugins.maven-surefire-plugin.version}</version>

               <configuration>

                    <parallel>methods</parallel>

                    <threadcount>4</threadcount>

               </configuration>

            </plugin>

        </plugins>

    </build>

    <dependencies>

        <dependency>

            <groupid>org.apache.felix</groupid>

            <artifactid>org.osgi.core</artifactid>

            <version>${org.apache.felix.org.osgi.core}</version>

        </dependency>

        <dependency>

            <groupid>junit</groupid>

            <artifactid>junit</artifactid>

            <version>4.8.2</version>

        </dependency>

        <dependency>

            <groupid>org.apache.felix</groupid>

            <artifactid>org.apache.felix.scr.annotations</artifactid>

            <version>1.9.0</version>

        </dependency>

        <dependency>

          <groupid>org.apache.felix</groupid>

          <artifactid>org.osgi.compendium</artifactid>

          <version>1.4.0</version>

</dependency>

    </dependencies>

</project>

 

i getting below error when run mvn install command.

"unresolved references [org.osgi.service.component] class(es) on bundle-classpath[jar:dot]: [com/adobe/support/examples/com/adobe/support/examples/osgi/service/sampleserviceimpl.cla ss]"

could please me fix it?

regards,

anderson

 


most culprit <import-package>org.osgi.framework;version="1.3.0"</import-package> in maven-bundle-plugin configuration. don't want explicitly state imports - let plugin figure out you. check out http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html details.



More discussions in Archived Spaces


adobe

Comments

Popular posts from this blog

how to devide a circle into equal parts

"Could not fill because there are not enough opaque source pixels" - not solved by any other thread

Why can't I change the billing info for my account?