Thanks Mikolaj,

I've patched my pom to use the exact version 1.2 but it still fail to resolve to hamcrest12 in rawhide. In fact hamcrest12(upstream version 1.2) is newer than hamcrest (upstream version 1.1). Shouldn't this make hamcrest obsolete?
I also updated my local dependency map to use 1.2 but maven still resolves to use hamcrest. Please help thanks.

========== how I patched it ========
%pom_remove_dep org.hamcrest:hamcrest-core
%pom_remove_dep org.hamcrest:hamcrest-library
%pom_xpath_inject "pom:dependencies" "<dependency><groupId>org.hamcrest</groupId><artifactId>hamcrest-core</artifactId><version>1.2</version><scope>test</scope></dependency>"
%pom_xpath_inject "pom:dependencies" "<dependency><groupId>org.hamcrest</groupId><artifactId>hamcrest-library</artifactId><version>1.2</version><scope>test</scope></dependency>"


Patrick Huang
Senior Software Engineer
Engineering - Internationalisation
Red Hat


From: "Mikolaj Izdebski" <mizdebsk@redhat.com>
To: "Patrick Huang" <pahuang@redhat.com>
Cc: java-devel@lists.fedoraproject.org
Sent: Monday, March 4, 2013 4:38:48 PM
Subject: Re: [fedora-java] hamcrest dependency in fedora rawhide

> I'm building a project using maven-local.
> My pom file has dependency to hamcrest-core and hamcrest-library
> version 1.2.1
> My spec file has
> BuildRequires: hamcrest12
>
> In my local box (f17) it resolved correctly. But when I try to build
> it in mock targeting rawhide, it always resolve to hamcrest (which
> is 1.1 and fail to compile)
> I've tried to add a depmap with -Dmaven.local.depmap.file as below,
> still no luck. Any one know why is that and how can I force it to
> reference hamcrest12 package? Thanks.

There are 2 reasons for that.

1. Your POM specifies version 1.2.1 of hamcrest, but in Fedora hamcrest12 has
version 1.2. Quote from Java packaging guidelines: "Maven will [...] return
versioned jar if it matches the version asked for in the pom file." In your
case these versions don't match. You need to patch your POM file to point to
the exact version available in the system if you want to use compatibility
package, otherwise default system version vill be used.

2. There is a bug in hamcrest12 package. It doesn't follow packaging guidelines
of compatibility packages. Quoting the guidelines: "Jar and pom files MUST be
versioned". In case of hamcrest12 they are not:

$ rpm -ql hamcrest12
/usr/share/doc/hamcrest12-1.2
/usr/share/doc/hamcrest12-1.2/LICENSE.txt
/usr/share/java/hamcrest12
/usr/share/java/hamcrest12/all.jar
/usr/share/java/hamcrest12/core.jar
/usr/share/java/hamcrest12/generator.jar
/usr/share/java/hamcrest12/library.jar
/usr/share/maven-fragments/hamcrest12
/usr/share/maven-poms/JPP.hamcrest12-all.pom
/usr/share/maven-poms/JPP.hamcrest12-core.pom
/usr/share/maven-poms/JPP.hamcrest12-generator.pom
/usr/share/maven-poms/JPP.hamcrest12-library.pom

You should report this bug against hamcrest12 package.

--
Mikolaj Izdebski