Our team of developers uses Maven for building software. We have Maven local repository on our computers. The problem is that sometimes builds made from two different developer differ, because the built packages include different version of included dependencies.
This happens when version tag is not mentioned in POM.xml file for dependencies. For example:
<dependency>
<groupId>mylib-group</groupId>
<artifactId>mylib-artifact</artifactId>
</dependency>
In this case Maven gets the newest library installed locally.
To avoid this problem We installed Maven on one computer (we call Build server) and all members of our team make build on that computer.
Is there any better solution for this case?
How can I have centralized Maven local ?
First of all: if you have a dependency like
<dependency>
<groupId>mylib-group</groupId>
<artifactId>mylib-artifact</artifactId>
</dependency>
Maven will not take the latest version, but the one defined in the <dependencyManagement>
section. So you get the same results on every computer (unless you have SNAPSHOT versions which might differ).
Having said that: Having a build server is generally a good idea for having a stable environment for builds.
Addendum: You can not share a Maven local repository. This repository is not thread safe and running two builds at the same time on the same local repository can have strange effects (I speak from experience).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With