我正在开发一个Opendaylight Oxygen应用程序,它在没有JPA的情况下编译并正常运行。但是我需要添加一个persistence.xml,所以我在下面添加了maven-plugin。它也可以编译,但是在“缺少需求[org.opendaylight.testodl.impl / 0.1.0] osgi.service”的功能测试中失败了。我在旧的Opendaylight版本中使用的同一个插件,它的工作原理。下面还提供了MANIFEST.mf和生成的feature.xml。有什么我想念的吗?或者,是否可以使用继承的插件并添加我的persistence.xml? 感谢。
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<instructions>
<Export-Package>
org.opendaylight.testodl.impl
</Export-Package>
<Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
</instructions>
</configuration>
</plugin>
MANIFEST.MF:
Manifest-Version: 1.0
Bnd-LastModified: 1528042731929
Build-Jdk: 1.8.0_161
Built-By: johnjob
Bundle-Description: OpenDaylight is leading the transformation to Open S
oftware Defined Networking (SDN). For more information, please see http
s://www.opendaylight.org
Bundle-DocURL: https://www.opendaylight.org
Bundle-License: https://www.eclipse.org/legal/epl-v10.html
Bundle-ManifestVersion: 2
Bundle-Name: ODL :: org.opendaylight.testodl :: testodl-impl
Bundle-SymbolicName: org.opendaylight.testodl.impl
Bundle-Vendor: OpenDaylight
Bundle-Version: 0.1.0
Created-By: Apache Maven Bundle Plugin
DynamicImport-Package: org.hibernate.proxy;javassist.util.proxy
Export-Package: org.opendaylight.testodl.impl;uses:="org.opendaylight.co
ntroller.md.sal.binding.api";version="0.1.0",org.opendaylight.testodl.i
mpl.service;uses:="javax.persistence";version="0.1.0"
Export-Service: org.opendaylight.testodl.impl.service.FlowService
Import-Package: javax.persistence,org.opendaylight.controller.md.sal.bin
ding.api;version="[1.7,2)",org.slf4j;version="[1.7,2)",org.hibernate.pr
oxy;resolution:=optional,javassist.util.proxy;resolution:=optional
Meta-Persistence: META-INF/persistence.xml
Provide-Capability: osgi.service;effective:=active;objectClass="org.apac
he.aries.jpa.template.JpaTemplate";osgi.unit.name=testodlpu,osgi.servic
e;effective:=active;objectClass="org.apache.aries.jpa.supplier.EmSuppli
er";osgi.unit.name=testodlpu,osgi.service;effective:=active;objectClass
="javax.persistence.EntityManagerFactory";osgi.unit.name=testodlpu,osgi
.service;effective:=active;objectClass="javax.persistence.EntityManager
";osgi.unit.name=testodlpu
Require-Capability: osgi.service;effective:=active;objectClass="",osgi.e
xtender;osgi.extender="aries.jpa",osgi.service;effective:=active;object
Class="javax.persistence.spi.PersistenceProvider";javax.persistence.pro
vider="org.hibernate.jpa.HibernatePersistenceProvider",osgi.service;eff
ective:=active;objectClass="javax.transaction.TransactionManager",osgi.
ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Tool: Bnd-3.3.0.201609221906
生成的feature.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-testodl">
<repository>mvn:org.apache.karaf.features/enterprise/4.1.5/xml/features</repository>
<repository>mvn:org.opendaylight.controller/odl-mdsal-broker/1.7.1/xml/features</repository>
<repository>mvn:org.opendaylight.testodl/odl-testodl-api/0.1.0/xml/features</repository>
<repository>mvn:org.opendaylight.odlparent/odl-karaf-feat-jdbc/3.1.0/xml/features</repository>
<feature name="odl-testodl" description="OpenDaylight :: testodl :: Persistence [Karaf Feature]" version="0.1.0">
<details>OpenDaylight is leading the transformation to Open Software Defined Networking (SDN). For more information, please see https://www.opendaylight.org</details>
<configfile finalname="etc/org.ops4j.datasource-testodl.cfg" override="false">
mvn:org.opendaylight.testodl/persistence/0.1.0/cfg/datasource
</configfile>
<feature version="2.6.1" prerequisite="false" dependency="false">jpa</feature>
<feature version="2.0.0" prerequisite="false" dependency="false">transaction</feature>
<feature version="1.7.1" prerequisite="false" dependency="false">odl-mdsal-broker</feature>
<feature version="0.1.0" prerequisite="false" dependency="false">odl-testodl-api</feature>
<feature version="3.1.0" prerequisite="false" dependency="false">odl-karaf-feat-jdbc</feature>
<feature prerequisite="true" dependency="false">wrap</feature>
<bundle>mvn:org.opendaylight.testodl/testodl-impl/0.1.0</bundle>
<bundle>wrap:mvn:org.hibernate.javax.persistence/hibernate-jpa-2.0-api/1.0.1.Final</bundle>
<bundle>mvn:org.apache.aries.blueprint/org.apache.aries.blueprint/1.1.0</bundle>
</feature>
</features>