当我尝试通过maven将我的软件包部署到OSGi时,它显示处于已安装状态。我的项目是多模块,所以有两个捆绑。我在taglib包中看到的是:
org.apache.felix.shell from org.apache.felix.shell (292)
org.apache.jackrabbit.api,version=[2.3,3) from org.apache.jackrabbit.jackrabbit-api (65)
org.apache.jackrabbit.api.jsr283.security -- Cannot be resolved
org.apache.jackrabbit.api.security,version=[2.3,3) from org.apache.jackrabbit.jackrabbit-api (65)
org.apache.jackrabbit.api.security.principal,version=[2.3,3) from org.apache.jackrabbit.jackrabbit-api (65)
org.apache.jackrabbit.api.security.user,version=[2.3,3) from org.apache.jackrabbit.jackrabbit-api (65)
检查完日志后,我在下面看到:
14.04.2017 17:23:03.330 *ERROR* [FelixDispatchQueue] com.abc.MyPrj-services FrameworkEvent ERROR (org.osgi.framework.BundleException: Unresolved constraint in bundle com.abc.MyPrj-services [290]: Unable to resolve 290.0: missing requirement [290.0] osgi.wiring.package; (osgi.wiring.package=org.apache.jackrabbit.api.jsr283.security)) org.osgi.framework.BundleException: Unresolved constraint in bundle com.abc.MyPrj-services [290]: Unable to resolve 290.0: missing requirement [290.0] osgi.wiring.package; (osgi.wiring.package=org.apache.jackrabbit.api.jsr283.security)
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3896)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1938)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1261)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:298)
at java.lang.Thread.run(Thread.java:745)
我在两个模块taglib,services中添加了以下依赖项。
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-api</artifactId>
<version>2.5.2</version>
<scope>provided</scope>
</dependency>
下面是taglib模块的pom:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>
com.mypkg.gwms.ra.tags.*;version=${project.version}
</Export-Package>
<Import-Package>
com.adobe.granite.*,
com.day.*,
javax.*,
org.apache.commons.*,
org.apache.sling.*,
org.apache.tika.*,
org.osgi.*,
org.w3c.dom.*,
org.xml.sax.*,
org.slf4j.*,
org.apache.felix.shell.*,
org.apache.jackrabbit.*,
</Import-Package>
<Include-Resource>
META-INF/${project.artifactId}-${project.version}.tld=${project.build.outputDirectory}/META-INF/${project.artifactId}-${project.version}.tld,
{maven-resources},
{maven-dependencies}
</Include-Resource>
<Sling-Bundle-Resources>
/META-INF/tags
</Sling-Bundle-Resources>
</instructions>
</configuration>
</plugin>
谢谢,
答案 0 :(得分:0)
该错误告诉您还需要安装提供包<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:fitsSystemWindows="true"
tools:context="project.udacity.com.investishare.ui.ItemsDetailActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_subhead_desc"
style="@style/TextAppearance.AppCompat.Caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/subheading_margin_bottom"
android:layout_marginLeft="@dimen/subheading_margin_left"
android:layout_marginStart="@dimen/subheading_margin_left"
android:drawableLeft="@drawable/ic_subtree"
android:drawablePadding="@dimen/subheading_drawable_padding"
android:drawableStart="@drawable/ic_subtree"
android:gravity="center_vertical"
android:paddingLeft="@dimen/subheading_padding_left"
android:paddingStart="@dimen/subheading_padding_left"
android:textColor="@color/color_white"
android:textSize="@dimen/tv_subhead_desc_text_size"
tools:text="@string/tv_subhead_desc_sample_text" />
<TextView
android:id="@+id/tv_shared_with"
style="@style/TextAppearance.AppCompat.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tv_subhead_desc"
android:layout_marginBottom="@dimen/subheading_margin_bottom"
android:layout_marginLeft="@dimen/subheading_margin_left"
android:layout_marginStart="@dimen/subheading_margin_left"
android:drawableLeft="@drawable/ic_shared_white"
android:drawablePadding="@dimen/subheading_drawable_padding"
android:drawableStart="@drawable/ic_shared_white"
android:gravity="center_vertical"
android:paddingEnd="@dimen/tv_shared_with_padding_right"
android:paddingLeft="@dimen/subheading_padding_left"
android:paddingRight="@dimen/tv_shared_with_padding_right"
android:paddingStart="@dimen/subheading_padding_left"
android:textColor="@color/color_white"
android:textSize="@dimen/tv_shared_with_text_size"
tools:text="@string/tv_shared_with_sample_text" />
<ImageView
android:id="@+id/iv_remove_sharing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@id/tv_subhead_desc"
android:layout_marginEnd="@dimen/subheading_drawable_padding"
android:layout_marginRight="@dimen/subheading_drawable_padding"
android:clickable="true"
android:contentDescription="@string/cd_remove_sharing"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:padding="@dimen/subheading_drawable_padding"
android:src="@drawable/ic_cancel_white" />
</RelativeLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_items_detail" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_detail_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/ic_shared_white" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="450dp"
android:id="@+id/details_bottom_sheet"
android:elevation="16dp"
android:background="@color/color_white"
app:layout_behavior="@string/bottom_sheet_behavior">
<TextView
android:id="@+id/bottom_sheet_header"
style="@style/Base.TextAppearance.AppCompat.Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/textview_bg"
android:padding="10dp"
android:text="hello"
android:textSize="24sp" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_bottom_sheet"
android:layout_width="match_parent"
android:layout_below="@id/bottom_sheet_header"
android:background="@color/color_white"
android:layout_height="wrap_content" />
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
的包。
如果导出此软件包,您可以签入软件包的清单。
答案 1 :(得分:0)
您应该安装一个包含org.apache.jackrabbit.api.jsr283.security包并将其导出到您的osgi容器的包。
答案 2 :(得分:0)
我被要求拥有相同API的2个依赖项,但具有不同的版本。最新的一个是在服务模块中使用。其他模块taglib正在寻找相同依赖项的旧版本来解析org.apache.jackrabbit.api.jsr283.security
为了解决这个问题,我在我的pom.xml中添加了以下语句。
<Import-Package>
org.apache.jackrabbit.*;version=1.6.1
</Import-Package>
仅导入1.6.1版本。这很有用。