English 中文(简体)
Maven: Unresolved reference to [org.osgiservice.
原标题:Maven: Unresolved references to [org.osgi.service.http]

I m 试图利用Httpservice为使用Maven-bundle-plugin的Serlet注册创建一种dle。

The pom.xml of the 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>felix-tutorial</groupId>
 <artifactId>example-1</artifactId>
 <version>1.0</version>
 <packaging>bundle</packaging>
 <name>Apache Felix Tutorial Example 1</name>
 <description>Apache Felix Tutorial Example 1</description>

 <!-- Build Configuration -->
 <build>
  <plugins>
   <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
     <instructions>
      <Bundle-SymbolicName>${pom.groupId}.${pom.artifactId}</Bundle-SymbolicName>
      <Bundle-Name>Service listener example</Bundle-Name>
      <Bundle-Description>A bundle that displays messages at startup and when service events occur</Bundle-Description>
      <Bundle-Vendor>Apache Felix</Bundle-Vendor>
      <Bundle-Version>1.0.0</Bundle-Version>
      <Bundle-Activator>tutorial.example1.Activator</Bundle-Activator>
      <Import-Package>org.osgi.framework;version="1.0.0", javax.servlet, javax.servlet.http</Import-Package>
     </instructions>
    </configuration>
   </plugin>
  </plugins>
 </build>

 <!-- Dependecies Management -->
 <dependencies>
  <dependency>
   <groupId>org.apache.felix</groupId>
   <artifactId>org.apache.felix.framework</artifactId>
   <version>2.0.4</version>
  </dependency>
  <dependency>
   <groupId>junit</groupId>
   <artifactId>junit</artifactId>
   <version>4.8.1</version>
   <scope>test</scope>
  </dependency>
  <dependency>
   <groupId>org.apache.felix</groupId>
   <artifactId>org.apache.felix.http.api</artifactId>
   <version>2.0.4</version>
  </dependency>
  <dependency>
   <groupId>org.apache.felix</groupId>
   <artifactId>org.apache.felix.http.base</artifactId>
   <version>2.0.4</version>
  </dependency>
  <dependency>
   <groupId>org.apache.felix</groupId>
   <artifactId>org.apache.felix.http.bridge</artifactId>
   <version>2.0.4</version>
  </dependency>
  <dependency>
   <groupId>org.apache.felix</groupId>
   <artifactId>org.apache.felix.http.bundle</artifactId>
   <version>2.0.4</version>
  </dependency>
  <dependency>
   <groupId>org.apache.felix</groupId>
   <artifactId>org.apache.felix.http.proxy</artifactId>
   <version>2.0.4</version>
  </dependency>
  <dependency>
   <groupId>org.apache.felix</groupId>
   <artifactId>org.apache.felix.http.whiteboard</artifactId>
   <version>2.0.4</version>
  </dependency>
  <dependency>
   <groupId>org.osgi</groupId>
   <artifactId>osgi_R4_compendium</artifactId>
   <version>1.0</version>
  </dependency>
 </dependencies>
</project>

“五安安装”的指挥系统有以下错误:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Felix Tutorial Example 1
[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.3/maven-resources-plugin-2.3.pom

Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.3/maven-resources-plugin-2.3.jar

Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.2/maven-install-plugin-2.2.pom

Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.2/maven-install-plugin-2.2.jar

Downloading: http://repo1.maven.org/maven2/org/apache/maven/shared/maven-filtering/1.0-beta-2/maven-filtering-1.0-beta-2.pom

Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-interpolation/1.6/plexus-interpolation-1.6.pom

Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-interpolation/1.6/plexus-interpolation-1.6.jar
Downloading: http://repo1.maven.org/maven2/org/apache/maven/shared/maven-filtering/1.0-beta-2/maven-filtering-1.0-beta-2.jar


[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:eclipsewsstripes-bundlesrcmain
esources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:eclipsewsstripes-bundlesrc	est
esources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: C:eclipsewsstripes-bundle	argetsurefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.beanopoly.stripes.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.031 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] [bundle:bundle {execution: default-bundle}]
[ERROR] Error building bundle felix-tutorial:example-1:bundle:1.0 : Unresolved references to [org.osgi.service.http] by class(es) on the Bundle-Classpath[Jar:do
[ERROR] Error(s) found in bundle configuration
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error(s) found in bundle configuration
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12 seconds
[INFO] Finished at: Sat Mar 27 13:11:47 CET 2010
[INFO] Final Memory: 12M/21M
[INFO] ------------------------------------------------------------------------
最佳回答

在夜总会的组合中,你必须具体说明你需要进口的所有包裹。

在你的情况下,应当:

   <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
     <instructions>
      ...
      <Import-Package>org.osgi.service.http, org.osgi.framework;version="1.0.0", javax.servlet, javax.servlet.http</Import-Package>
     </instructions>
    </configuration>
   </plugin>
问题回答

答案是错误的。 你们不需要具体说明你们进口的所有包裹。 在你关于进口(没有定义)缺失的包裹的指示末尾简单地列出:

<Import-Package>org.osgi.framework;version="1.0.0", javax.servlet, javax.servlet.http**,***</Import-Package>

Use the newer bundle version: org.apache.felix maven-bundle-plugin 2.0.0 true





相关问题
JavaFX with Maven [closed]

I recently started a JavaFX project, and I d like to use Maven as my compiler/deployment tool. Is there a good tutorial or plugin to integrate JavaFX and Maven?

How to upload jar to respository?

I have jar files that cannot be found on Maven Central repository. I would like to add the jar so I can just include extra tag in my pom.xml file and other developer can use the jar. What are the ...

Debug Maven project in Eclipse with third party sources

I am currently developing a maven project in eclipse. The m2eclipse plugin works beautifully. It even works out of the box with debugging. But when I am debugging open source third party libarries. ...

Could Free Pascal benefit of something like Apache Maven?

Apache Maven is a very popular build and dependency management tool in the Java open source ecosphere. I did some tests to find out if it can handle compiled Free Pascal / Delphi units and found it ...

Run a single test method with maven

I know you can run all the tests in a certain class using: mvn test -Dtest=classname But I want to run an individual method and -Dtest=classname.methodname doesn t seem to work.

Uploading a directory using sftp with Maven

How can I upload a directory - Eclipse update site - using sftp with public key authentication in Maven? For background information: I m using tycho to build an Eclipse plugin and want to get the ...

What are solid NMaven or build servers for .NET alternatives?

Maven had a long history and is well supported in the Java world. NMaven has received a less successful start and has never become as popular in the C#/.NET world as its larger cousin was in the Java ...

热门标签