Hi
I need my code to use another library which is a part of my company's repository and available in Bitbucket. I asked Rovo agent to add the needed dependency in pom.xml which it did and updated code to use this dependent class, but the generated code had compilation errors which I assume due to a fact that my library is not a part of a public repository. Is there a way to solve this?
Thank you.
Hey @Galina Rogozinsky !
When you add a dependency in pom.xml
that points to a library only available in your company's private Bitbucket repository. Maven can't fetch it unless that library has been published to a Maven repository that your project can access.
By default, Maven looks in public repositories (like Maven Central), so if your internal library isn't published to a private Maven repository (like JFrog Artifactory or Nexus), the dependency won't resolve, leading to compilation errors.
Try this!
1) Publish the Internal Library to a Private Maven Repository
Your company should publish the internal library (from Bitbucket) to a private Maven repository (e.g., JFrog Artifactory, Nexus, or a company-hosted Maven repo).
Once published, add the repository details to your project's pom.xml
under the <repositories>
section, so Maven knows where to look for the dependency.
2) Configure Your Project to Use the Private Repository
In your pom.xml
, add the repository configuration:
<repositories>
<repository>
<id>company-internal</id>
<url>https://your-artifactory-url/repository/maven-releases/</url>
</repository>
</repositories>
Make sure your dependency declaration matches the groupId, artifactId, and version used when publishing the library.
Alternatively, you can build the Internal library locally (as a temporary workaround)
If publishing to a Maven repo isn't possible yet, you can build the internal library locally and install it to your local Maven repository using:
mvn install
This makes the library available for your project on your machine only.
@Jaime Escribano (knowmad mood) also shared a good tip!
Let us know if this helps you in any way!
Kindest regards,
Jov