Aspose cad error while building through jenkins

[ERROR] Failed to execute goal on project egov-edcr: Could not resolve dependencies for project org.egov.edcr:egov-edcr:jar:2.1.1-SNAPSHOT: Failed to collect dependencies at com.aspose:aspose-cad:jar:20.10: Failed to read artifact descriptor for com.aspose:aspose-cad:jar:20.10: Could not transfer artifact com.aspose:aspose-cad:pom:20.10 from/to AsposeJavaAPI (http://releases.aspose.com/repo/): com.ibm.jsse2.util.h: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is:
[ERROR] java.security.cert.CertPathValidatorException: The certificate issued by CN=Starfield Services Root Certificate Authority - G2, O=“Starfield Technologies, Inc.”, L=Scottsdale, ST=Arizona, C=US is not trusted; internal cause is:
[ERROR] java.security.cert.CertPathValidatorException: Certificate chaining error
[ERROR] → [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] DependencyResolutionException - Apache Maven - Apache Software Foundation
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :egov-edcr
error building image: error building stage: failed to execute command: waiting for process to exit: exit status 1
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE

getting this error, while building through jenkis. Sharing the repo and dependency that we are using

AsposeJavaAPI Aspose Java API http://releases.aspose.com/repo/
</repositories>

	<dependency>
		<groupId>com.aspose</groupId>
		<artifactId>aspose-cad</artifactId>
		<version>20.10</version>
	</dependency>

@nehasharma

The error you are encountering while building your project through Jenkins is related to a certificate validation issue when trying to resolve the Aspose CAD dependency. Specifically, the error indicates that the certificate from the Aspose repository is not trusted, which is causing the build to fail.

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

  1. Update the Repository URL: Ensure that you are using the correct and secure URL for the Aspose repository. The recommended URL is https://repository.aspose.com/repo. Update your pom.xml to reflect this change:

    <repositories>
        <repository>
            <id>AsposeJavaAPI</id>
            <name>Aspose Java API</name>
            <url>https://repository.aspose.com/repo/</url>    
        </repository>
    </repositories>
    
  2. Trust the Certificate: If you are still facing issues, you may need to import the certificate into your Java keystore. You can do this by following these steps:

    • Download the certificate from the Aspose repository.
    • Use the keytool command to import the certificate into your Java keystore:
      keytool -import -alias aspose -file path/to/certificate.crt -keystore path/to/keystore.jks
      
    • Make sure to specify the correct path to your keystore and the downloaded certificate.
  3. Check Java Version: Ensure that you are using a compatible version of Java that supports the required security protocols. Sometimes, older versions of Java may not trust newer certificates.

  4. Run Maven with Debugging: To get more detailed information about the error, you can run Maven with the -e and -X switches:

    mvn clean install -e -X
    

    This will provide a more verbose output that can help in diagnosing the issue further.

By following these steps, you should be able to resolve the dependency resolution issue and successfully build your project through Jenkins. If the problem persists, consider checking the Aspose forums or documentation for any updates or additional troubleshooting steps.

Sources:
[1]: The new clould repository is missing some POM files

We have tried using the both the repos
https://repository.aspose.com/repo/
http://releases.aspose.com/repo/

still facing the same error

@nehasharma,
Hello, could you please check if library works without jenkins.

Yes, the library is working without jenkins. But we want to use jenkins only. We dont want to do it manually

@nehasharma,
it looks like you need to install our root certificate, probably, this could be helpful.