How to use Aspose.Words for Java with Gradle

I am using aspose.word for java latest dependency in my project. My project use gradle as build tool. I would like to know how do I add aspose.word for java latest dependency into my project. Specially changes to build.gradle file.


Please try adding the following configurations to your build.gradle file:

maven {
    url "" }


compile (
        group: 'com.aspose',
        name: 'aspose-words',
        version: '20.9',
        classifier: 'jdk17')

Hope, this helps.

Thanks Tahir. Its resolved now. The license file “Aspose.Words.lic” I hope this file needs to be available in compile time and runtime of the application. We are creating a war file to deploy into tomcat. What is the standard way of making this available to runtime. Do we have to add it to war package itself. Also any recommended way of loading it, I am using as below for loading it,

FileInputStream fstream = new FileInputStream(dataDir + “Aspose.Words.lic”);

Is this a good practice. Please advise.


In your case, we suggest you please add the license into your project as embedded resources. Please add the resources folder into your Java project as shown in attached image. license test.png (33.6 KB)

Following code example shows how to read the license file from resources folder. Hope this helps you.

ClassLoader cl = Thread.currentThread().getContextClassLoader();
InputStream is = cl.getResourceAsStream("Aspose.Total.Java.lic");
com.aspose.words.License lic = new com.aspose.words.License();
System.out.println("License is set as : " + lic.isLicensed());