Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
org.springframework.osgi.context does not exists Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment

    Working...
    X