You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Egor Pahomov <pa...@gmail.com> on 2014/02/19 12:55:11 UTC
Solution for handeling many conflicts in maven dependencies.
Problem: I need to combine using of many artifacts in my maven project:
hbase, hadoop-client, akka, spray, netflix-curator, spark. All these
artifacts depend on different versions of other artifacts: zookeper-client,
protobuf, jetty, etc. I've spent 3 days just to write all excludes
correctly to archive version compatibility. So now I've got pretty
consistent configuration. I want to create a framework to help my
colleagues, who work on a similar stack, to use results of my work and
don't spend 3 days on writing excludes.
I'm aware of maven-enforcer-plugin, which doesn't allow you to use the
same artifacts with a different version. It helps, but it's not enough.
I would love to hear about solutions you might suggest. Here's my vision: I
create a parent pom with dependency management only. In this dependency
management I write all the excludes and make the artifacts compatible. Then
someone can use this pom as a parent and just write dependencies. But there
is a problem. We excluded zookeeper from netflix-curator and hadoop, but
not from hbase. So when we use all 3 artifacts we receive zookeeper from
hbase, but when use only netflix-curator and hadoop we can lost needed
artifacts. And we would recognize it only when in Runtime we receive
"ClassNotFoundException". That's why I want to write an additional plugin
for this case. This plugin would check: if you have dependency on some
artifact, you should depend on artifacts, which were excluded from that
artifact. If you lost some artifact, you need to add it or configure an
exception.
What do you think about such solution?
--
*Sincerely yoursEgor PakhomovScala Developer, Yandex*
Re: Solution for handeling many conflicts in maven dependencies.
Posted by Wayne Fay <wa...@gmail.com>.
> is a problem. We excluded zookeeper from netflix-curator and hadoop, but
> not from hbase. So when we use all 3 artifacts we receive zookeeper from
> hbase, but when use only netflix-curator and hadoop we can lost needed
> artifacts.
You should have a direct dependency on zookeeper if you are using it,
and not just assume you will get it as a transitive dependency from
hbase. What happens when hbase suddenly stops using zookeeper (even if
this is wildly unlikely)?
> And we would recognize it only when in Runtime we receive
> "ClassNotFoundException". That's why I want to write an additional plugin
> for this case. This plugin would check: if you have dependency on some
> artifact, you should depend on artifacts, which were excluded from that
> artifact. If you lost some artifact, you need to add it or configure an
> exception.
Have you looked at the dependency plugin, specifically the analyze mojo?
https://maven.apache.org/plugins/maven-dependency-plugin/analyze-mojo.html
Wayne
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Solution for handeling many conflicts in maven dependencies.
Posted by Ron Wheeler <rw...@artifact-software.com>.
http://blog.artifact-software.com/tech/?p=121
This describes how we solved the problem.
We built libraries that had groups of related libraries aggregated into
a single jar where we fixed all of the version conflicts.
Then developers only have to depend on a small number of jars that have
the versions set the way we want.
We have jars for
Spring
CXF
Jasper Reports
JSF
Jetspeed
Tomcat and Java
Hibernate&MySQL
and so on. About 10 in total. These represent about 70Mb of code and
configuration.
We have one called "shared" that picks up all the little utilities from
Apache and others like logging, mail, document production, XML parsing.
The approved set is issued with the same version number so that
developers know which set to use.
This makes their lives easier.
We also provide those libraries as jar files so that project jars only
have their own code in them so they build quickly.
Once you load the libraries into your container, you only have small
files to handle each time you want to refresh your test site.
On 19/02/2014 6:55 AM, Egor Pahomov wrote:
> Problem: I need to combine using of many artifacts in my maven project:
> hbase, hadoop-client, akka, spray, netflix-curator, spark. All these
> artifacts depend on different versions of other artifacts: zookeper-client,
> protobuf, jetty, etc. I've spent 3 days just to write all excludes
> correctly to archive version compatibility. So now I've got pretty
> consistent configuration. I want to create a framework to help my
> colleagues, who work on a similar stack, to use results of my work and
> don't spend 3 days on writing excludes.
>
> I'm aware of maven-enforcer-plugin, which doesn't allow you to use the
> same artifacts with a different version. It helps, but it's not enough.
>
> I would love to hear about solutions you might suggest. Here's my vision: I
> create a parent pom with dependency management only. In this dependency
> management I write all the excludes and make the artifacts compatible. Then
> someone can use this pom as a parent and just write dependencies. But there
> is a problem. We excluded zookeeper from netflix-curator and hadoop, but
> not from hbase. So when we use all 3 artifacts we receive zookeeper from
> hbase, but when use only netflix-curator and hadoop we can lost needed
> artifacts. And we would recognize it only when in Runtime we receive
> "ClassNotFoundException". That's why I want to write an additional plugin
> for this case. This plugin would check: if you have dependency on some
> artifact, you should depend on artifacts, which were excluded from that
> artifact. If you lost some artifact, you need to add it or configure an
> exception.
>
> What do you think about such solution?
>
>
--
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org