How to avoid library name clashes when building a WAR?

Let’s say we have: * project “A” which generates artifact “Q” version 1, named Q-1.jar * project “B” which generates artifact “Q” version 1, named Q-1.jar * project “C” which depends on A:Q:1 and B:Q:1 and generates a WAR file with A:Q:1 and B:Q:1 in the class path.

Both A:Q:1 and B:Q:1 will end up in WEB-INF/lib. But the file names of both these artifacts is Q-1.jar.

Is there a nice way to make sure I have both artifacts in WEB-INF/lib if such a situation occur by prepending the group to the file name: A-Q-1.jar, B-Q-1.jar?