Невозможно разрешить пакет, отсутствует требование JAX-RS - PullRequest
1 голос
/ 25 февраля 2020

Я пытаюсь использовать JAX-RS в AEM (OSGi), но мой пакет не активен из-за отсутствия требования.

org. apache .aries.javax.jax.rs-api устанавливается как отдельный пакет, и он активен

Cannot start (org.osgi.framework.BundleException: Unable to resolve com.aem.demo.core [603](R 603.11): missing requirement [com.aem.demo.core [603](R 603.11)] osgi.implementation; (&(osgi.implementation=osgi.jaxrs)(version>=1.0.0)(!(version>=2.0.0))) Unresolved requirements: [[com.aem.demo.core [603](R 603.11)] osgi.implementation; (&(osgi.implementation=osgi.jaxrs)(version>=1.0.0)(!(version>=2.0.0)))])

org.osgi.framework.BundleException: невозможно разрешить com.aem.demo.core [603] (R 603.11): отсутствует требование [com.aem. demo.core [603] (R 603.11)] osgi.implementation; (& (osgi.implementation = osgi.jaxrs) (версия> = 1.0.0) (! (версия> = 2.0.0))) Нерешенные требования: [[com.aem.demo.core [603] (R 603.11) ] osgi.implementation; (& (osgi.implementation = osgi.jaxrs) (версия> = 1.0.0) (! (версия> = 2.0.0)))]

Зависимости

        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.core</artifactId>
            <version>7.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.cmpn</artifactId>
            <version>7.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.annotation</artifactId>
            <version>7.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.component.annotations</artifactId>
            <version>1.4.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.metatype.annotations</artifactId>
            <version>1.4.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.component</artifactId>
            <version>1.4.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>biz.aQute.bnd</groupId>
            <artifactId>biz.aQute.bndlib</artifactId>
            <version>5.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.aries.spec</groupId>
            <artifactId>org.apache.aries.javax.jax.rs-api</artifactId>
            <version>1.0.4</version>
            <scope>provided</scope>
        </dependency>

Плагины

            <plugin>
                <groupId>biz.aQute.bnd</groupId>
                <artifactId>bnd-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>bnd-process</id>
                        <goals>
                            <goal>bnd-process</goal>
                        </goals>
                        <configuration>
                            <bnd><![CDATA[
Bundle-Category: demo
Import-Package: javax.annotation;version=0.0.0,*
-exportcontents: ${packages;VERSIONED}
Sling-Model-Packages: com.aem.core.models
-snapshot: ${tstamp;yyyyMMddHHmmssSSS}
Bundle-DocURL:
-plugin org.apache.sling.caconfig.bndplugin.ConfigurationClassScannerPlugin
                                ]]></bnd>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>org.apache.sling.caconfig.bnd-plugin</artifactId>
                        <version>1.0.2</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>biz.aQute.bnd</groupId>
                <artifactId>bnd-baseline-maven-plugin</artifactId>
                <configuration>
                    <failOnMissing>false</failOnMissing>
                </configuration>
                <executions>
                    <execution>
                        <id>baseline</id>
                        <goals>
                            <goal>baseline</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Манифест моего пакета

Symbolic Name   com.aem.demo.core
Version 1.0.0.20200225143408035
Bundle Location jcrinstall:/apps/my-aem-project/install/com.aem.demo.core-1.0.0-SNAPSHOT.jar
Last Modification   Tue Feb 25 15:34:51 CET 2020
Description "Core bundle for My AEM Project"
Start Level 20
Exported Packages   com.aem.demo.core.controllers,version=1.0
com.aem.demo.core.dto,version=1.0
com.aem.demo.core.filters,version=1.0
com.aem.demo.core.listeners,version=1.0
com.aem.demo.core.models,version=1.0
com.aem.demo.core.schedulers,version=1.0
com.aem.demo.core.services,version=1.0
com.aem.demo.core.servlets,version=1.0
Imported Packages   com.day.cq.wcm.api,version=[1.27,2) from com.day.cq.wcm.cq-wcm-api (461)
com.aem.demo.core.controllers,version=[1.0,2) from com.aem.demo.core (603)
com.aem.demo.core.dto,version=[1.0,2) from com.aem.demo.core (603)
com.aem.demo.core.filters,version=[1.0,2) from com.aem.demo.core (603)
com.aem.demo.core.listeners,version=[1.0,2) from com.aem.demo.core (603)
com.aem.demo.core.servlets,version=[1.0,2) from com.aem.demo.core (603)
javax.annotation,version=0.0.0 from org.apache.geronimo.specs.geronimo-annotation_1.3_spec (2)
javax.servlet,version=[2.6,3) from org.apache.felix.http.servlet-api (52)
javax.ws.rs from org.apache.aries.javax.jax.rs-api (598)
org.apache.sling.api,version=[2.3,3) from org.apache.sling.api (77)
org.apache.sling.api.request,version=[2.4,3) from org.apache.sling.api (77)
org.apache.sling.api.resource,version=[2.11,3) from org.apache.sling.api (77)
org.apache.sling.api.servlets,version=[2.2,3) from org.apache.sling.api (77)
org.apache.sling.models.annotations,version=[1.5,2) from org.apache.sling.models.api (543)
org.apache.sling.models.annotations.injectorspecific,version=[1.1,2) from org.apache.sling.models.api (543)
org.apache.sling.settings,version=[1.3,2) from org.apache.sling.settings (4)
org.osgi.service.event,version=[1.4,2) from org.apache.felix.eventadmin (40)
org.slf4j,version=[1.7,2) from slf4j.api (7)
Manifest Headers    Bnd-LastModified: 1582641248035
Build-Jdk-Spec: 1.8
Bundle-Category: demo
Bundle-Description: "Core bundle for My AEM Project"
Bundle-ManifestVersion: 2
Bundle-Name: My AEM Project - Core
Bundle-SymbolicName: com.aem.demo.core
Bundle-Version: 1.0.0.20200225143408035
Created-By: 1.8.0_162 (Oracle Corporation)
Export-Package: com.aem.demo.core.controllers; version="1.0"; uses:="com.aem.demo.core.dto, javax.ws.rs", com.aem.demo.core.dto; version="1.0", com.aem.demo.core.filters; version="1.0"; uses:="javax.servlet", com.aem.demo.core.listeners; version="1.0"; uses:="org.osgi.service.event", com.aem.demo.core.models; version="1.0"; uses:="javax.annotation, org.apache.sling.api.resource, org.apache.sling.models.annotations", com.aem.demo.core.schedulers; version="1.0", com.aem.demo.core.services; version="1.0", com.aem.demo.core.servlets; version="1.0"; uses:="javax.servlet, org.apache.sling.api, org.apache.sling.api.servlets"
Import-Package: javax.annotation; version="0.0.0", com.day.cq.wcm.api; version="[1.27, 2)", com.aem.demo.core.controllers; version="[1.0, 2)", com.aem.demo.core.dto; version="[1.0, 2)", com.aem.demo.core.filters; version="[1.0, 2)", com.aem.demo.core.listeners; version="[1.0, 2)", com.aem.demo.core.servlets; version="[1.0, 2)", javax.servlet; version="[2.6, 3)", javax.ws.rs, org.apache.sling.api; version="[2.3, 3)", org.apache.sling.api.request; version="[2.4, 3)", org.apache.sling.api.resource; version="[2.11, 3)", org.apache.sling.api.servlets; version="[2.2, 3)", org.apache.sling.models.annotations; version="[1.5, 2)", org.apache.sling.models.annotations.injectorspecific; version="[1.1, 2)", org.apache.sling.settings; version="[1.3, 2)", org.osgi.service.event; version="[1.4, 2)", org.slf4j; version="[1.7, 2)"
Manifest-Version: 1.0
Private-Package: com.aem.demo.core.dao, com.aem.demo.core.schedulers.config
Provide-Capability: osgi.service; objectClass:List="com.aem.demo.core.controllers.PersonController", osgi.service; objectClass:List="com.aem.demo.core.schedulers.SimpleScheduledTask, java.lang.Runnable", osgi.service; objectClass:List="javax.servlet.Filter", osgi.service; objectClass:List="javax.servlet.Servlet", osgi.service; objectClass:List="org.osgi.service.event.EventHandler"
Require-Capability: osgi.extender; filter:="(&(osgi.extender=osgi.component)(version>=1.4.0)(!(version>=2.0.0)))", osgi.implementation; filter:="(&(osgi.implementation=osgi.http)(version>=1.1.0)(!(version>=2.0.0)))", osgi.implementation; filter:="(&(osgi.implementation=osgi.jaxrs)(version>=1.0.0)(!(version>=2.0.0)))", osgi.service; filter:="(osgi.jaxrs.media.type=application/json)"; resolution:=optional; effective:=active, osgi.contract; osgi.contract=JavaJAXRS; filter:="(&(osgi.contract=JavaJAXRS)(version=2.1.0))", osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/com.aem.demo.core.controllers.PersonController.xml, OSGI-INF/com.aem.demo.core.filters.LoggingFilter.xml, OSGI-INF/com.aem.demo.core.listeners.SimpleResourceListener.xml, OSGI-INF/com.aem.demo.core.schedulers.SimpleScheduledTask.xml, OSGI-INF/com.aem.demo.core.servlets.SimpleServlet.xml
Sling-Model-Packages: com.aem.core.models
Tool: Bnd-4.2.0.201903051501

Манифест орг. apache .aries.javax.jax.rs-api

Symbolic Name   org.apache.aries.javax.jax.rs-api
Version 1.0.4
Bundle Location jcrinstall:/apps/my-aem-project-vendor-packages/application/install/org.apache.aries.javax.jax.rs-api-1.0.4.jar
Last Modification   Mon Feb 24 16:12:59 CET 2020
Start Level 20
Bundle Classpath    .,lib/geronimo-osgi-locator.jar
Exported Packages   javax.ws.rs,version=2.1.0
javax.ws.rs.client,version=2.1.0
javax.ws.rs.container,version=2.1.0
javax.ws.rs.core,version=2.1.0
javax.ws.rs.ext,version=2.1.0
javax.ws.rs.sse,version=2.1.0
Imported Packages   javax.net.ssl,version=0.0.0.JavaSE_001_008 from org.apache.felix.framework (0)
javax.xml.bind.annotation,version=2.2.1 from org.apache.servicemix.specs.jaxb-api-2.2 (1)
javax.xml.bind.annotation.adapters,version=2.2.1 from org.apache.servicemix.specs.jaxb-api-2.2 (1)
javax.xml.namespace,version=2.1.0 from org.apache.felix.framework (0)
org.osgi.framework,version=1.9.0 from org.apache.felix.framework (0)
org.osgi.util.tracker,version=1.5.2 from org.apache.felix.framework (0)
Manifest Headers    Bnd-LastModified: 1550757575220
Build-Jdk: 1.8.0_161
Built-By: sac
Bundle-ClassPath: ., lib/geronimo-osgi-locator.jar
Bundle-ManifestVersion: 2
Bundle-Name: Apache Aries JAX-RS Specification API
Bundle-SymbolicName: org.apache.aries.javax.jax.rs-api
Bundle-Version: 1.0.4
Created-By: Apache Maven 3.5.4
Export-Package: javax.ws.rs; version="2.1"; uses:="javax.ws.rs.core", javax.ws.rs.client; version="2.1"; uses:="javax.net.ssl, javax.ws.rs, javax.ws.rs.core", javax.ws.rs.container; version="2.1"; uses:="javax.ws.rs.core", javax.ws.rs.core; version="2.1"; uses:="javax.ws.rs, javax.xml.bind.annotation, javax.xml.bind.annotation.adapters, javax.xml.namespace", javax.ws.rs.ext; version="2.1"; uses:="javax.ws.rs, javax.ws.rs.core", javax.ws.rs.sse; version="2.1"; uses:="javax.ws.rs.client, javax.ws.rs.core"
Import-Package: org.apache.geronimo.osgi.registry.api; resolution:=optional, javax.net.ssl, javax.ws.rs; version="[2.1, 3)", javax.ws.rs.core; version="[2.1, 3)", javax.xml.bind.annotation, javax.xml.bind.annotation.adapters, javax.xml.namespace, org.osgi.framework, org.osgi.util.tracker
Manifest-Version: 1.0
Private-Package: lib, org.apache.geronimo.osgi.locator
Provide-Capability: osgi.contract; osgi.contract=JavaJAXRS; uses:="javax.ws.rs, javax.ws.rs.client, javax.ws.rs.container, javax.ws.rs.core, javax.ws.rs.ext, javax.ws.rs.sse"; version:List="2.1, 2, 1.1"
Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Tool: Bnd-4.0.0.201805111645
...