Integrate Asopse Words Java in Maven multi module project

Hi Team,

I have got trial license Aspose.Total and now I am facing issues with dependencies. I have included the dependency as below in my pom.xml

groupId: com.aspose
artifactId : aspose-words
version : 23.8
classifier : jdk17

When I added that dependency and if I go to m2 folder I am not seeing any jar files related tp Aspose Words library.

How can I get jar file in my m2 folder so that I can use Aspose Words java APIs and will use the license.

Also please let me know how can I use Aspose.TotalforJava.lic file in my maven project?

Thanks!!

@ramesh676 Once you add dependency to Aspose.Words in your pom.xml, Maven will resolve this dependency and download the required packages from the repository. No additional action are required.

Aspose license is a simple xml file that contains licensing information and the key. You can store this file anywhere in your project. You should apply the license in your code like this:

com.aspose.words.License wordsLic = new com.aspose.words.License();
wordsLic.setLicense("C:\\Path_To_License_File\\Aspose.Total.Java.lic");

Please see our documentation to learn more about licensing:
https://docs.aspose.com/words/java/licensing/

Hi @alexey.noskov

When I added Aspose.Words in my pom.xml , maven was unable to download jar files. I would like know if I need to add something like any repositories tag? Maven was only able to download .lastUpdated files but not jars.

I would like to know what is the purpose of setting license in java class as below:

com.aspose.words.License wordsLic = new com.aspose.words.License();
wordsLic.setLicense("C:\\Path_To_License_File\\Aspose.Total.Java.lic");

I have commented out above two lines in my java class , even though I am able to convert html to pdf. If I don’t use above 2 lines in my java class will there be any impact? Does aspose validates the user license with just above lines of code?

Thanks !!

@ramesh676 In your pom.xml you should have the following configuration:

...
        <repository>
            <id>AsposeJavaAPI</id>
            <name>Aspose Java API</name>
            <url>https://releases.aspose.com/java/repo/</url>
        </repository>
...
...
        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose-words</artifactId>
            <version>23.8</version>
            <classifier>jdk17</classifier>
        </dependency>
...

Without setting the license Aspose.Words will work in evaluation mode and will inject an evaluation version watermark into the output document and limit the maximum size of the processed documents to several hundreds of paragraphs.

Hi @alexey.noskov,

We have defined above mentioned configuration in my pom.xml. Even tough maven is unable to download jar files. It is only able to download .lastUpadted files. Please have a look at below image.

image.png (18.6 KB)

If I use any new dependency then maven is able to download all the jars, the only problem is with aspose words dependency.

Thanks,
Ramesh

I am getting below error

[ERROR] Failed to execute goal on project test.core: Could not resolve dependencies for project com.test.core:jar:1.0.0-SNAPSHOT: Failed to collect dependencies at com.aspose:aspose-pdf:jar:22.12: Failed to read artifact descriptor for com.aspose:aspose-pdf:jar:22.12: Could not transfer artifact com.aspose:aspose-pdf:pom:22.12

[ERROR] Failed to execute goal on project test.core: Could not resolve dependencies for project com.test.core:jar:1.0.0-SNAPSHOT: Failed to collect dependencies at com.aspose:aspose-pdf:jar:22.12: Failed to read artifact descriptor for com.aspose:aspose-pdf:jar:22.12: Could not transfer artifact com.aspose:aspose-pdf:pom:22.12

@alexey.noskov

@ramesh676 As I can see the error occurs not with Aspose.Words but with Aspose.PDF. Please make sure you have proper configuration for Aspose.PDF in your pom:

<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-pdf</artifactId>
    <version>23.7</version>
</dependency>

as described here:
https://releases.aspose.com/pdf/java/

Hi @alexey.noskov,

I am getting same error for aspose.words as well.

We are also using one more repository in my pom.xml. On top of existing repository I added aspose repository.

Same error was posted in aspose communiity but there was no proper solution yet for this

@ramesh676,

Unfortunately, we can’t reproduce this problem on our side. Could you please send a snippet or complete pom file that you are using. This may help us better understand and resolve your issue.

Hi @alexey.maslov @alexey.noskov

I have downloaded the zscalar certificate from Aspose Repository Browser /java/repo/ and I added this to java keystore then it started working fine and able to download the jars.

But If I buy a license will aspose issue us zscalar certificate?? We need this security cert to download dependencies

@ramesh676 No, there should not be any issues. Evaluation and licensed versions of Aspose.Words is the same Jar. It simply works in evaluation mode if the license is not applied in your code.

Hi @alexey.noskov,

com.aspose.words.License wordsLic = new com.aspose.words.License();
wordsLic.setLicense("C:\\Path_To_License_File\\Aspose.Total.Java.lic");

Instead of setting license in above manner is there any way to just define token code ?

I want to check if there is any way I can include unique code to set license instead of above?

I mean in Java I will use as below

String signature ="H/5emtr7Toocu7zQyR0djP/L0D8hZfbTjUoSo+As.....";

I see signature element in the license I received from ASPOSE, can I use above signature value to let know that I am valid aspose user? Signature string or any other unique code?

@ramesh676 Unfortunately, you cannot set the license such way. But you can store the license as an embedded resource and pass license stream into setLicense method, instead of passing license file name.