Aspose words - Maven build

Hello,

We are using aspose mailmerge for generating pdf documents using word templates. Users have reported the performance is very slow and we wanted to see if the latest version of aspose would address the performance issue. However, when we try to update to latest aspose version, maben build fails with the following error. We are using Java 7 jars and aspose version 24.3. Please advise.

Failed to execute goal on project ECM_GenerateMergedDocument: Could not resolve dependencies for project Judiciary:ECM_GenerateMergedDocument:jar:0.0.1-SNAPSHOT: 
Could not transfer artifact com.aspose:aspose-words:jar:shaping-harfbuzz-plugin:24.8 from/to AsposeJavaAPI (http://artifact.aspose.com/repo/): 
authorization failed for http://artifact.aspose.com/repo/com/aspose/aspose-words/24.8/aspose-words-24.8-shaping-harfbuzz-plugin.jar, status: 403 Forbidden -> [Help 1]

@judiciary

It seems you are encountering a dependency resolution issue while trying to update to the latest version of Aspose.Words in your Maven project. The error message indicates that there is an authorization failure when attempting to access the Aspose repository for the required artifact.

Here are some steps you can take to resolve this issue:

  1. Check Repository URL: Ensure that the repository URL in your pom.xml file is correct. The URL should point to the Aspose Maven repository. It typically looks like this:

    <repository>
        <id>AsposeJavaAPI</id>
        <url>http://artifact.aspose.com/repo/</url>
    </repository>
    
  2. Authentication: Since the error indicates a “403 Forbidden” status, it may be necessary to provide authentication credentials. You can do this by adding your Aspose credentials to your settings.xml file located in the .m2 directory. Here’s an example of how to configure it:

    <servers>
        <server>
            <id>AsposeJavaAPI</id>
            <username>YourUsername</username>
            <password>YourPassword</password>
        </server>
    </servers>
    
  3. Version Compatibility: Make sure that the version of Aspose.Words you are trying to use is compatible with your Java version. You mentioned using Java 7; ensure that the version of Aspose.Words you are trying to use supports it.

  4. Update Dependencies: If you are still facing performance issues, consider checking the release notes of the latest versions of Aspose.Words to see if there are any performance improvements or bug fixes that might address your concerns.

  5. Consult Documentation: For more detailed instructions on setting up Aspose.Words with Maven, you can refer to the official documentation, which provides guidance on installation and usage within different IDEs like IntelliJ IDEA and Eclipse.

If you continue to experience issues after trying these steps, please provide additional details about your pom.xml configuration and any other relevant information, and I would be happy to assist further.

Sources:
[1]: Aspose.Words for IntelliJ IDEA - Maven
[2]: Installing and Using Aspose.Words for IntelliJ IDEA|Aspose.Words for Java

Attached the pom.xml which worked for the current version (23.8) which
we are using
pom.docx (16.4 KB)

@judiciary Please modify your POL like the following:

<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>24.9</version>
    <classifier>jdk17</classifier>
</dependency>
<dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-words</artifactId>
    <version>24.9</version>
    <classifier>shaping-harfbuzz-plugin</classifier>
</dependency>

Getting the following now

Failed to execute goal on project ECM_GenerateMergedDocument: Could not resolve dependencies for project Judiciary:ECM_GenerateMergedDocument:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.aspose:aspose-words:jar:jdk17:24.9, com.aspose:aspose-words:jar:javadoc:24.9, com.aspose:aspose-words:jar:shaping-harfbuzz-plugin:24.9: Could not transfer artifact com.aspose:aspose-words:jar:jdk17:24.9 from/to AsposeJavaAPI (https://releases.aspose.com/java/repo/): authorization failed for https://releases.aspose.com/java/repo/com/aspose/aspose-words/24.9/aspose-words-24.9-jdk17.jar, status: 403 Forbidden -> [Help 1]

@judiciary,

Everything works on my side when I use the following .pom:

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>Judiciary</groupId>
    <artifactId>ECM_GenerateMergedDocument</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>ECM_GenerateMergedDocument</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <version.maven-install-plugin>2.5.2</version.maven-install-plugin>
        <version.non-maven1>1.0.0</version.non-maven1>
        <version.non-maven2>1.0.0</version.non-maven2>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                    <compilerArgument>-proc:none</compilerArgument>
                    <forceJavacCompilerUse>true</forceJavacCompilerUse>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.2</version>
                <configuration>
                    <createDependencyReducedPom>false</createDependencyReducedPom>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                        implementation="com.github.edwgiz.maven_shade_plugin.log4j2_cache_transformer.PluginsCacheFileTransformer">
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.github.edwgiz</groupId>
                        <artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
                        <version>2.13.0</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <finalName>ECM_GenerateMergedDocument</finalName>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>
            <!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-bom -->
            <dependency>
                <groupId>com.amazonaws</groupId>
                <artifactId>aws-java-sdk-bom</artifactId>
                <version>1.11.981</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <repositories>
        <repository>
            <id>AsposeJavaAPI</id>
            <name>Aspose Java API</name>
            <url>https://releases.aspose.com/java/repo/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-s3</artifactId>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-lambda-java-core</artifactId>
            <version>1.2.1</version>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-lambda-java-events</artifactId>
            <version>2.2.2</version>
        </dependency>
        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose-words</artifactId>
            <version>24.9</version>
            <classifier>jdk17</classifier>
        </dependency>
        <dependency>
            <groupId>com.aspose</groupId>
            <artifactId>aspose-words</artifactId>
            <version>24.9</version>
            <classifier>shaping-harfbuzz-plugin</classifier>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20200518</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>

    </dependencies>

</project>

Try using the specified .pom, and also clear the contents of the repository\com\aspose\aspose-words folder inside your .m2 directory before building.