The issue you’re facing stems from a dependency conflict in your Maven project. The error message indicates that Maven couldn’t resolve the dependency for com.paypal.sdk:paypal-core:jar:LATEST.
The detail error message as below:
Failed to execute goal on project common: Could not resolve dependencies for project com.project:common:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.paypal.sdk:merchantsdk:jar:2.15.122 -> com.paypal.sdk:paypal-core:jar:LATEST: Failed to read artifact descriptor for com.paypal.sdk:paypal-core:jar:LATEST: Failed to resolve version for com.paypal.sdk:paypal-core:jar:LATEST: Could not find metadata com.paypal.sdk:paypal-core/maven-metadata.xml
Solution
Here’s how to fix it:
In pom.xml, you’ve specified the version for com.paypal.sdk:paypal-core as LATEST. This is problematic because Maven doesn’t know which specific version to fetch.
To resolve this, replace LATEST with an actual version number.
Step 1: Check the available versions of paypal-core in AWS CodeArtifact repository or the Maven Central Repository.
Step 2: Update the <version> tag for paypal-core dependency like this:
<dependency> <groupId>com.paypal.sdk</groupId> <artifactId>paypal-core</artifactId> <version>1.7.2</version> <!-- Replace with the actual version number --> </dependency>
Step 3: Save the pom.xml file and re-run the Maven build command. It should now successfully resolve the dependencies.
Additionally, ensure that AWS CodeArtifact repository is properly configured in settings.xml or pom.xml file. Double-check the repository URL and credentials.
If the issue persists, try the following:
- Clear local Maven repository by deleting the .m2/repository directory and re-run the build.
- Verify that the required dependencies are available in AWS CodeArtifact repository.
- Check if there are any conflicting dependencies in project that might interfere with the resolution process.
By specifying a concrete version for the paypal-core dependency and ensuring proper repository configuration, you should be able to resolve the dependency conflicts and successfully build Maven project using AWS CodeArtifact.