Importing third party jar file

Hello

I am using the latest version of CUBA and would like to add some third party jar files to my project. How can i get this done?

Hi,

If that jar is available in some maven repository (e.g. Maven Central) you need to add this repository to the build.gradle file and just add the library as a regular gradle dependency. You can use Project Properties window (See Studio Guide) or just manually add to build.grade.

    repositories { 
...
        mavenCentral()
     }

configure(globalModule) {
    dependencies {
...
         compile('com.company.thirdparty:third-party:1.0.0')
    }
}

If you want to add some local .jar file to the project, you need to add flatDir repository to your build.gradle file and add dependency to that jar.

For example if you have /<my_project>/libs/third-party.jar

    repositories { 
...
        flatDir {
            dirs '$project.rootDir/libs'
        }
     }

configure(globalModule) {
    dependencies {
...
         compile(name: 'third-party')
    }
}
1 Like

Thanks.

This solved my problem.