我正在使用OSGI开发Web应用程序。我有一个maven配置错误,我找不到。这是完整的源代码: http://uploading.com/files/8e5c9888/SH_27_test.zip/
这是POM文件:
<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>
<parent>
<groupId>org.DX_57.osgi.SH_27</groupId>
<artifactId>SH_27</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>SH_27-impl</artifactId>
<packaging>bundle</packaging>
<name>SH_27-impl</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
<artifactId>SH_27-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>SH_27-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>${pom.groupId}.api, org.osgi.framework</Import-Package>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Bundle-Activator>${pom.groupId}.impl.SessionHandleApp</Bundle-Activator>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<groupId>org.DX_57.osgi.SH_27</groupId>
</project>
当我尝试使用Netbeans编译它时,我收到此错误: http://pastebin.com/whxuSb7V
添加@Datasource时会出现问题。似乎我在POM文件中遗漏了一些东西,但我不知道它是什么?
任何帮助都将受到高度赞赏。
祝福 彼得
答案 0 :(得分:2)
结帐Maven: Unresolved references to [org.osgi.service.http]。我认为他遇到了同样的问题,他通过包含需要导入的特定软件包来解决这个问题。
答案 1 :(得分:2)
这是解决方案:
<Import-Package>${pom.groupId}.api, org.osgi.framework</Import-Package>
应该是:
<Import-Package>*</Import-Package>
我希望这会对某人有所帮助。