Pregunta

A problem that relates to basic maven concepts:

Once released I would like to have a guarantee that the project build is fully reproducible. So all project and plugin dependencies, including transitive one, should be always resolved the same way.

Unfortunately it is not the case, if dependencies are expressed in terms of version ranges. It can happen that even though direct dependencies of a project are set (using versions:use-releases), the transitive dependencies can still be resolved in some other way in the future.

How to address the problem? Is there a known solution?

I was thinking (just an idea), about creating a plugin, which on release time would dump all dependencies of the project to a separate file, and then once building in the future, the dependencies read from the file would take precedence over the standard way maven uses to resolve dependencies. But I'm afraid that there is no plugin api for that. So it would require some hacking, which I would like to avoid. Is there another way?

Thanks, Lukasz

¿Fue útil?

Solución

Freeze artifacts versions using <dependencyManagement>. Even if you don't use version ranges (as you said), but rather 3rd party libs (your dependencies) do, your <dependencyManagement> will have higher priority in specifying version of any artifacts.

Otros consejos

The simple solution is: Do not use version-ranges. This is bad practice cause it will result in the described problems.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top