Nedislav Kolev
Nedislav Kolev

Reputation: 1

Can you add External Maven Library in GitLab CI/CD

I have external library in my maven project. The library is local and made for the project. Can I somehow add the external library so my pipeline could work?

Here is the output from the GitLab CI/CD:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.651 s
[INFO] Finished at: 2021-12-16T11:23:18Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project ServerTCPMaven: Could not resolve dependencies for project org.example:ServerTCPMaven:jar:1.0-SNAPSHOT: Could not find artifact org.example:MaNikFileLibrary:jar:1.0 in central (https://repo.maven.apache.org/maven2) -> [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] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
ERROR: Job failed: exit code 1```

Upvotes: 0

Views: 1824

Answers (1)

Boris W
Boris W

Reputation: 111

You have at least two options:

  1. You can upload your dependency to an internal Maven repository (e.g. Nexus). Then you can configure your settings.xml to use this repository. See https://maven.apache.org/settings.html#Repositories

  2. You can move the dependency into your project and reference the local dependency. See How to add local jar files to a Maven project?

Upvotes: 1

Related Questions