Search code examples
javaeclipsegradleportletliferay-7

Liferay unresolved requirment


I need to use some classes in a liferay module project from another Java project. I'm using gradle and when I deploy my app I get the Unresolved requirement error even though the gradle compiles my jar file.

Here is what I did so far, My gradle.build:

compile files('libs/p01-jdbc.jar')  
compileOnly group: "org.mql.biblio.dao.jdbc", name: "p01-jdbc", version: "default"

My bnd file:

Bundle-Name: Inter_Portlet_Communication
Bundle-SymbolicName: Inter_Portlet_Communication
Bundle-Version: 1.0.0
Export-Package: \
    com.mql.ipc.constants
Include-Resource: @p01-jdbc.jar

And my imports

import org.mql.biblio.dao.jdbc.DataBase;
import org.mql.biblio.dao.jdbc.DataSource;
import org.mql.biblio.dao.jdbc.MySQLDataSource;

P.S: The jar I'm compiling also uses a local mysql.jar (in a folder called lib).


Solution

  • Found the answer to my problme, I had to use compileInclude instead of compile. I also needed to add a line for another jar needed by my dependency jar:

    compileInclude files('libs/p01-jdbc.jar') 
    compileInclude files('libs/mysql.jar') //This jar is used by the first one