How to integrate Aspose API for Maven Project

First of All you need to download the latest Aspose APIs by using any of the following methods

 Note: This tutorial assumes that you have basic understanding about Maven and Java Project.

Create Aspose APIs Maven repository

After downloading Aspose APIs, you need to create lib and asposeapis at the root of your java or java web project.

Note: If you have not yet installed Maven 3 in your system please refer to installing and configuring Maven 3.  

Then copy downloaded Aspose Java API jars into the lib folder and use the following maven command syntax on command shell / linux shell to create the Aspose APIs repository into your project.

For configuring Aspose.Words with Maven :

mvn deploy:deploy-file -Durl=file:asposeapi/ -Dfile=lib/aspose-words-14.4.1-jdk16.jar -DgroupId=com.aspose -DartifactId=aspose.words -Dpackaging=jar -Dversion=14.4.1

 

As you can see you have to specify correct downloaded api jar (aspose-words-14.4.1-jdk16.jar) for Aspose.Words for configuring it with Maven.

For configuring Aspose.Email, Aspose.Cells and Aspose.Barcode, you have to repeat the same command with the correct jar file names, version id and artifactId for later specifying into Maven configuration as project dependencies.

Note: Please refer to asposedeploy.bat and asposedeploy.sh shell scripts (of this project) for Maven shell commands for creating Aspose API repository into your project.

Having created Aspose API repository into your project you then need to specify the repository location (asposeapis) into your Maven dependencies configuration file (pom.xml) as below:

 <repositories>
        <repository>
            <id>aspose.com</id>
            <name>AsposeAPI</name>
            <url>file:${project.basedir}/asposeapis</url>
        </repository>
 </repositories>

And dependencies as below:

 <dependencies>
        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose.pdf.kit</artifactId>
            <version>4.7.0</version>
        </dependency>
        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose.pdf.jdk</artifactId>
            <version>14</version>
        </dependency>
        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose.words</artifactId>
            <version>14.4.1</version>
        </dependency>
        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose.cells</artifactId>
            <version>8.0.2</version>
        </dependency>
        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose.email</artifactId>
            <version>4.1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose.barcode</artifactId>
            <version>5.8.0</version>
        </dependency>
        <dependency>

     ..... .....

 <dependencies>

Note: Please refer to pom.xml file comes with this project source code for working example. 

Afterward you can delete lib folder you created for copying downloaded Aspose APIs jars, as now you have created Aspose API maven repository you don't need it.

Your Maven Aspose APIs repository may look like this once you finished:

AsposeAPI Maven Repository Example

You can now further look into AsposeAPI.java source came with this project for the Aspose APIs examples and usage.


Recommended Links

Last edited Jun 17, 2014 at 8:28 AM by AdeelIlyas, version 30