Results 1 to 2 of 2

Thread: org.springframework.osgi.context does not exists

  1. #1
    Join Date
    Sep 2008
    Posts
    4

    Default org.springframework.osgi.context does not exists

    spring-osgi-bundle-archetype got problem with org.springframework.osgi.context does not exist

    I create a bundle project with

    Code:
     mvn archetype:create \
    -DarchetypeGroupId=org.springframework.osgi \
    -DarchetypeArtifactId=spring-osgi-bundle-archetype \
    -DarchetypeVersion=1.1.1  \
    -Dversion=1.0 \
    -DgroupId=test \
    -DartifactId=HelloSpringOSGi
    And create a Foo class with BundleContextAware
    Code:
    import org.osgi.framework.BundleContext;
    import org.springframework.osgi.context.BundleContextAware;
    
    public class Foo implements BundleContextAware{
    	public void setBundleContext(BundleContext ctx) {
    	}
    }
    Add import header in pom.xml
    Code:
    <Import-Package>*,org.springframework.osgi.context,org.osgi.framework</Import-Package>
    do mvn package then error occurred
    Code:
    C:\tmp\foooooo\src\main\java\Foo.java:[2,39] package org.springframework.osgi.co
    ntext does not exist
    
    C:\tmp\foooooo\src\main\java\Foo.java:[4,28] cannot find symbol
    symbol: class BundleContextAware
    public class Foo implements BundleContextAware{
    Anybody know how to fix it ?

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    the bundle creator is aimed at creating spring application that do not depend directly on Spring DM. If you do you just have to import the needed jar in your pom.xml file as dependencies. For your case you would have to import spring-osgi-io and spring-osgi-core.
    And by the way, there is no need to specify the packages in <Import-Package> - using a * means that the tool will identifies the packages by itself.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •