Miguel
Miguel

Reputation: 121

Liferay 7 service module Unresolved requiremen

I am developing some features for Liferay 7. I know is still in beta version but I am facing some troubles with OSGi package dependencies. When I am trying to deploy service project an error occurred while deploying

Unresolved requirement: Import-Package: com.liferay.asset.kernel.model; version="[1.0.0,2.0.0)"

Anda the same happens with other like expando import packages.

The question is that in my Eclipse Mars there is no error and in Dependencies I can find that clases inside the Jar com.liferay.portal.kernel and I don't know why is throwing that error.

In my build.gradle I have this dependence

compile 'com.liferay.portal:com.liferay.portal.kernel:2.1.0'

My bnd file contains the next:

 Bundle-Version: 1.0.0 
Liferay-Service: true
Require-Capability: liferay.extender;filter:="(&(liferay.extender=spring.extender)(version>=1.0)(!(version>=3.0)))"
Liferay-Require-SchemaVersion: 1.0.0
Liferay-Spring-Context: META-INF/spring
-sources: true
Import-Package: \
    com.liferay.portal.service;version="7.0.0",\
    com.liferay.portal.kernel;version='2.1.0',\
    org.osgi.framework;version="[1.7,2)",\
    *

Anybody knows where to look where are those runtime dependencies limiting to 1.0.0 to 2.0.0?

Any help will be welcome because I am loosing a lot of time and I am really beginner in this.

I think I am managing with this but a new problem appears... When I do a buildService in my service project it creates all stuff but the problem is it create wrong in SqlUpdateFactoryUtil, parameters given are not the same as API for 7.0 so the error thrown is:

SqlUpdate sqlUpdate = SqlUpdateFactoryUtil.getSqlUpdate(dataSource,
                                                      ^
  required: DataSource,String,int[]
  found: DataSource,String
  reason: actual and formal argument lists differ in length

So I guess that the service builder plugin is not sync with the version of my jars

Upvotes: 1

Views: 6531

Answers (3)

m.irouch
m.irouch

Reputation: 61

Add this line to the bnd.bnd file and this will resolve your issue:

Import-Package: *; version="0";resolution:=optional

Upvotes: 2

Miguel
Miguel

Reputation: 121

Replying myself and for all those who face the same problem.

The point is a mix of issues.

  • Elipse Mars does not refresh Jars dependencies automatically, you need to use the option "Gradle --> Refresh Gradle Project".
  • Bad usage of dependencies. As I am a beginner, I use incorrectly dependences and try to import kernel but portal-service 7.0.0 is enough.

Now all my three projects (service, api and web) are correctly deployed and active.

Now I am facing other problem trying to contain in the same protect multiple MVCPortlet clases. But this is other war.

Upvotes: 1

Jérémie B
Jérémie B

Reputation: 11032

You are using version 2.1.0 of the artifact com.liferay.portal:com.liferay.portal.kernel.

However, someone declare a runtime dependencies on this artifact with version [1.0.0, 2.0.0) : Greater or equals to 1, and strictly lesser than 2. This version can't be resolved, as 2.1 is greater than 2.

You should check your manifest to fix this dependencies, or better, use a tools (as bnd) to generate this manifest.

Upvotes: 0

Related Questions