%global namedreltag .RELEASE
%global namedversion %{version}%{?namedreltag}
%global oname spring-data-jpa
%if 0%{?fedora}
# Unavailable dependencies and build tools
%bcond_with aspectj
%bcond_with test
%endif
Name: springframework-data-jpa
# Newer release require springframework >= 4.0.7.RELEASE
Version: 1.6.6
Release: 1%{?dist}
Summary: Simplifies the development of creating a JPA-based data access layer
License: ASL 2.0
URL: http://projects.spring.io/spring-data-jpa/
Source0: https://github.com/spring-projects/spring-data-jpa/archive/%{namedversion}.tar.gz
Patch0: %{name}-1.6.4-remove-aspectj-support.patch
BuildRequires: maven-local
BuildRequires: mvn(com.mysema.maven:apt-maven-plugin)
BuildRequires: mvn(com.mysema.querydsl:querydsl-apt)
BuildRequires: mvn(com.mysema.querydsl:querydsl-jpa)
BuildRequires: mvn(javax.enterprise:cdi-api)
BuildRequires: mvn(joda-time:joda-time)
BuildRequires: mvn(org.apache.openjpa:openjpa-persistence-jdbc)
BuildRequires: mvn(org.eclipse.persistence:org.eclipse.persistence.jpa)
BuildRequires: mvn(org.hibernate:hibernate-entitymanager)
BuildRequires: mvn(org.hibernate:hibernate-jpamodelgen)
BuildRequires: mvn(org.springframework:spring-aop)
BuildRequires: mvn(org.springframework:spring-beans)
BuildRequires: mvn(org.springframework:spring-context)
BuildRequires: mvn(org.springframework:spring-core)
BuildRequires: mvn(org.springframework:spring-instrument)
BuildRequires: mvn(org.springframework:spring-orm)
BuildRequires: mvn(org.springframework:spring-tx)
BuildRequires: mvn(org.springframework.data:spring-data-commons)
%if %{with aspectj}
BuildRequires: mvn(org.apache.openjpa:openjpa)
BuildRequires: mvn(org.aspectj:aspectjrt)
BuildRequires: mvn(org.aspectj:aspectjtools)
BuildRequires: mvn(org.aspectj:aspectjweaver)
BuildRequires: mvn(org.codehaus.mojo:aspectj-maven-plugin)
BuildRequires: mvn(org.springframework:spring-aspects)
%endif
# Test deps
%if %{with test}
BuildRequires: mvn(javax.el:el-api)
BuildRequires: mvn(javax.servlet:javax.servlet-api)
BuildRequires: mvn(org.apache.openjpa:openjpa)
BuildRequires: mvn(org.apache.openwebbeans.test:cditest-owb)
BuildRequires: mvn(org.aspectj:aspectjweaver)
BuildRequires: mvn(hsqldb:hsqldb:1)
BuildRequires: mvn(org.hsqldb:hsqldb:2.2.8)
%endif
BuildArch: noarch
%description
Spring Data JPA, part of the larger Spring Data family,
makes it easy to easily implement JPA based repositories.
This module deals with enhanced support for JPA based
data access layers. It makes it easier to build Spring
powered applications that use data access technologies.
%package javadoc
Summary: Javadoc for %{name}
%description javadoc
This package contains javadoc for %{name}.
%prep
%setup -q -n %{oname}-%{namedversion}
cp -p src/main/resources/*.txt .
sed -i 's/\r//' *.txt
# https://github.com/spring-projects/spring-data-build
%pom_remove_parent
# Remove unavailable plugins
%pom_remove_plugin :wagon-maven-plugin
# Remove unwanted plugin
%pom_remove_plugin :maven-assembly-plugin
%if %{without test}
%pom_remove_dep :openjpa
%pom_xpath_remove "pom:plugin[pom:artifactId='apt-maven-plugin']/pom:executions/pom:execution[pom:id= 'test-sources']"
%endif
%pom_xpath_set "pom:dependency[pom:groupId='org.aspectj']/pom:version" 1.6.12
%if %{without aspectj}
%pom_remove_plugin :aspectj-maven-plugin
%pom_remove_dep :spring-aspects
%pom_remove_dep org.aspectj:
%patch0 -p1
%endif
# fix non ASCII chars
for s in src/main/java/org/springframework/data/jpa/mapping/JpaMetamodelMappingContext.java \
src/main/java/org/springframework/data/jpa/repository/Lock.java \
src/main/java/org/springframework/data/jpa/repository/query/StringQuery.java \
src/main/java/org/springframework/data/jpa/repository/query/StringQueryParameterBinder.java;do
native2ascii -encoding UTF8 ${s} ${s}
done
# Set dependecies version (available in parent pom)
%pom_xpath_set "pom:dependency[pom:groupId='com.mysema.querydsl']/pom:version" 3.6.4
%pom_xpath_set "pom:dependency[pom:groupId='javax.enterprise']/pom:version" 1.1
%pom_xpath_set "pom:dependency[pom:groupId='joda-time']/pom:version" 2.3
%pom_xpath_set "pom:dependency[pom:artifactId='spring-instrument']/pom:version" 3.2.14.RELEASE
%pom_xpath_set "pom:dependency[pom:artifactId='hibernate-entitymanager']/pom:version" 4.3.1.Final
%pom_xpath_set "pom:plugin[pom:artifactId='apt-maven-plugin']/pom:version" 1.1.3
# Force servlet 3.1 apis
%pom_change_dep :servlet-api :javax.servlet-api:3.1.0
%pom_change_dep org.hsqldb:hsqldb:'${hsqldb1}' hsqldb:hsqldb:1
# [ERROR] cannot find symbol
# [ERROR] symbol: method createNamedStoredProcedureQuery(java.lang.String)
# [ERROR] symbol: method createStoredProcedureQuery(java.lang.String)
# [ERROR] symbol: method getEntityGraph(java.lang.String)
# [ERROR] location: variable em of type javax.persistence.EntityManager
%pom_add_dep org.hibernate.javax.persistence:hibernate-jpa-2.1-api
# Add OSGi support
%pom_xpath_inject "pom:project" "bundle"
%pom_add_plugin org.apache.felix:maven-bundle-plugin:2.3.7 . '
true
org.springframework.data.jpa
${project.name}
Pivotal Software, Inc.
${project.version}
bundle-manifest
process-classes
manifest
'
%mvn_file : %{oname}
%build
# Unavailable test deps
%if %{without test}
opts="-f"
%endif
%mvn_build $opts -- -Dproject.build.sourceEncoding=UTF-8
%install
%mvn_install
%files -f .mfiles
%doc changelog.txt readme.*
%license license.txt notice.txt
%files javadoc -f .mfiles-javadoc
%license license.txt notice.txt
%changelog
* Mon Jul 06 2015 gil cattaneo 1.6.6-1
- update to 1.6.6.RELEASE
* Sun Jul 05 2015 gil cattaneo 1.6.4-1
- initial rpm