From 1b1f0eaad25cd9c9dbaebc7d00c9ee70daba1969 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Wed, 20 Jul 2016 09:49:12 +0200 Subject: [PATCH] Fix Maven artifact installation - Resolves: rhbz#1358134 --- postgresql-jdbc.spec | 38 +++++++++++--------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/postgresql-jdbc.spec b/postgresql-jdbc.spec index 9e63f87..39df4fd 100644 --- a/postgresql-jdbc.spec +++ b/postgresql-jdbc.spec @@ -56,9 +56,6 @@ URL: http://jdbc.postgresql.org/ Source0: https://github.com/pgjdbc/pgjdbc/archive/REL%version.tar.gz Source1: postgres-testing.sh -Provides: mvn(org.postgresql:postgresql) -Provides: mvn(postgresql:postgresql) - # Upstream moved parent pom.xml into separate project (even though there is only # one dependant project on it?). Let's try to not complicate packaging by # having separate spec file for it, too. @@ -118,15 +115,16 @@ find -name "*.jar" -or -name "*.class" | xargs rm -f %pom_disable_module ubenchmark -# Hack #0! For upstream it is to some extent important to have the parent-poms -# project separated. Having it like that on downstream level does not help at -# all. Note that we have to revert this patch before we do the installation. -sed -i.hack-parent-poms \ - 's!!../pgjdbc-parent-poms/pgjdbc-core-parent/pom.xml!' \ - pgjdbc/pom.xml -sed -i.hack-parent-poms \ - '/pgjdbc-versions/a pgjdbc-parent-poms/pgjdbc-versions/pom.xml' \ - pom.xml +# Build parent POMs in the same Maven call. +%pom_xpath_inject pom:modules "%parent_poms_builddir" +%pom_xpath_inject pom:parent "pgjdbc-parent-poms/pgjdbc-versions" +%pom_xpath_set pom:relativePath ../pgjdbc-parent-poms/pgjdbc-core-parent pgjdbc + +# Parent POMs should be installed in a separate subpackage. +%mvn_package ":*{parent,versions,prevjre}*" parent-poms + +# For compat reasons, make Maven artifact available under older coordinates. +%mvn_alias org.postgresql:postgresql postgresql:postgresql # Hack #1! This directory is missing for some reason, it is most probably some # misunderstanding between maven, maven-compiler-plugin and @@ -164,29 +162,15 @@ EOF pgtests_start %endif -# First "build" the parent-poms .. -cd %parent_poms_builddir -%mvn_build -- %pgjdbc_mvn_options -cd .. -# .. and then build pgjdbc. - %if %runselftest %mvn_build -- %pgjdbc_mvn_options %else %mvn_build -- %pgjdbc_mvn_options -Dmaven.test.skip=true %endif -# Hack #0! Revert the patch above. -for i in `find -name '*.hack-parent-poms'` -do - mv $i ${i%%%%.hack-parent-poms} -done - %install %mvn_install -cd %parent_poms_builddir -%mvn_install %check @@ -196,7 +180,7 @@ cd %parent_poms_builddir %license LICENSE %doc README.md -%files parent-poms -f %parent_poms_builddir/.mfiles +%files parent-poms -f .mfiles-parent-poms %files javadoc %license LICENSE