Create EPEL 6 package using the maven ant plugin

This commit is contained in:
Mattias Ellert 2018-01-06 15:27:21 +01:00
commit f3218ffdb7
4 changed files with 408 additions and 19 deletions

23
build.xml Normal file
View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!-- Ant build file (http://ant.apache.org/) for Ant 1.6.2 or above. -->
<!-- ====================================================================== -->
<project name="voms-api-java" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Import maven-build.xml into the current project -->
<!-- ====================================================================== -->
<import file="maven-build.xml"/>
<!-- ====================================================================== -->
<!-- Help target -->
<!-- ====================================================================== -->
<target name="help">
<echo message="Please run: $ant -projecthelp"/>
</target>
</project>

38
maven-build.properties Normal file
View file

@ -0,0 +1,38 @@
#Generated by Maven Ant Plugin - DO NOT EDIT THIS FILE!
#Fri Jan 05 13:07:13 CET 2018
maven.build.testDir.0=src/test/java
plugin.nexus-staging.version=1.6.3
canl.version=2.2.1
maven.settings.offline=true
plugin.assembly.version=2.4.1
junit.version=4.11
maven.settings.interactiveMode=true
assembly.javadoc.dir=/usr/share/javadoc/voms-api-java
plugin.deploy.version=2.8.2
maven.reporting.outputDirectory=${maven.build.dir}/site
project.build.sourceEncoding=UTF-8
maven.build.testOutputDir=${maven.build.dir}/test-classes
plugin.release.version=2.2.2
jcip.version=1.0
plugin.cobertura.version=2.5.2
maven.build.finalName=voms-api-java-3.2.0
mockito.version=1.9.5
maven.test.reports=${maven.build.dir}/test-reports
plugin.source.version=2.2.1
hamcrest.version=1.3
maven.repo.local=${user.home}/.m2/repository
maven.build.dir=target
maven.build.outputDir=${maven.build.dir}/classes
project.reporting.outputEncoding=UTF-8
plugin.jar.version=2.5
project.build.directory=${maven.build.dir}
assembly.doc.dir=/usr/share/doc/voms-api-java
maven.build.resourceDir.0=src/main/resources
plugin.compiler.version=3.1
plugin.gpg.version=1.5
maven.build.srcDir.0=src/main/java
assembly.java.dir=/usr/share/java
maven.build.testResourceDir.0=src/test/resources
project.build.outputDirectory=${maven.build.outputDir}
plugin.license.version=1.9.0
plugin.javadoc.version=2.9.1

305
maven-build.xml Normal file
View file

@ -0,0 +1,305 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!-- Ant build file (http://ant.apache.org/) for Ant 1.6.2 or above. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- ===================== - DO NOT EDIT THIS FILE! - ===================== -->
<!-- ====================================================================== -->
<!-- -->
<!-- Any modifications will be overwritten. -->
<!-- -->
<!-- Generated by Maven Ant Plugin on 1/5/18 1:07 PM -->
<!-- See: http://maven.apache.org/plugins/maven-ant-plugin/ -->
<!-- -->
<!-- ====================================================================== -->
<project name="voms-api-java-from-maven" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Build environment properties -->
<!-- ====================================================================== -->
<property file="${user.home}/.m2/maven.properties"/>
<property file="maven-build.properties"/>
<property name="maven.build.finalName" value="voms-api-java-3.2.0"/>
<property name="maven.build.dir" value="target"/>
<property name="maven.build.outputDir" value="${maven.build.dir}/classes"/>
<property name="maven.build.srcDir.0" value="src/main/java"/>
<property name="maven.build.resourceDir.0" value="src/main/resources"/>
<property name="maven.build.testOutputDir" value="${maven.build.dir}/test-classes"/>
<property name="maven.build.testDir.0" value="src/test/java"/>
<property name="maven.build.testResourceDir.0" value="src/test/resources"/>
<property name="maven.test.reports" value="${maven.build.dir}/test-reports"/>
<property name="maven.reporting.outputDirectory" value="${maven.build.dir}/site"/>
<property name="maven.repo.local" value="${user.home}/.m2/repository"/>
<property name="maven.settings.offline" value="false"/>
<property name="maven.settings.interactiveMode" value="true"/>
<!-- ====================================================================== -->
<!-- Defining classpaths -->
<!-- ====================================================================== -->
<path id="build.classpath">
<pathelement location="${maven.repo.local}/eu/eu-emi/security/canl/2.2.1/canl-2.2.1.jar"/>
<pathelement location="${maven.repo.local}/org/bouncycastle/bcpkix-jdk15on/1.52/bcpkix-jdk15on-1.52.jar"/>
<pathelement location="${maven.repo.local}/org/bouncycastle/bcprov-jdk15on/1.52/bcprov-jdk15on-1.52.jar"/>
<pathelement location="${maven.repo.local}/commons-io/commons-io/2.4/commons-io-2.4.jar"/>
<pathelement location="${maven.repo.local}/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar"/>
</path>
<path id="build.test.classpath">
<pathelement location="${maven.repo.local}/junit/junit/4.11/junit-4.11.jar"/>
<pathelement location="${maven.repo.local}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
<pathelement location="${maven.repo.local}/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar"/>
<pathelement location="${maven.repo.local}/eu/eu-emi/security/canl/2.2.1/canl-2.2.1.jar"/>
<pathelement location="${maven.repo.local}/org/bouncycastle/bcpkix-jdk15on/1.52/bcpkix-jdk15on-1.52.jar"/>
<pathelement location="${maven.repo.local}/org/bouncycastle/bcprov-jdk15on/1.52/bcprov-jdk15on-1.52.jar"/>
<pathelement location="${maven.repo.local}/commons-io/commons-io/2.4/commons-io-2.4.jar"/>
<pathelement location="${maven.repo.local}/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar"/>
<pathelement location="${maven.repo.local}/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5.jar"/>
<pathelement location="${maven.repo.local}/org/objenesis/objenesis/1.0/objenesis-1.0.jar"/>
</path>
<!-- ====================================================================== -->
<!-- Cleaning up target -->
<!-- ====================================================================== -->
<target name="clean" description="Clean the output directory">
<delete dir="${maven.build.dir}"/>
</target>
<!-- ====================================================================== -->
<!-- Compilation target -->
<!-- ====================================================================== -->
<target name="compile" depends="get-deps" description="Compile the code">
<mkdir dir="${maven.build.outputDir}"/>
<javac destdir="${maven.build.outputDir}"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="1.6"
verbose="false"
fork="false"
source="1.6">
<src>
<pathelement location="${maven.build.srcDir.0}"/>
</src>
<classpath refid="build.classpath"/>
</javac>
<copy todir="${maven.build.outputDir}">
<fileset dir="${maven.build.resourceDir.0}"/>
</copy>
</target>
<!-- ====================================================================== -->
<!-- Test-compilation target -->
<!-- ====================================================================== -->
<target name="compile-tests"
depends="compile"
description="Compile the test code"
unless="maven.test.skip">
<mkdir dir="${maven.build.testOutputDir}"/>
<javac destdir="${maven.build.testOutputDir}"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="1.6"
verbose="false"
fork="false"
source="1.6">
<src>
<pathelement location="${maven.build.testDir.0}"/>
</src>
<classpath>
<path refid="build.test.classpath"/>
<pathelement location="${maven.build.outputDir}"/>
</classpath>
</javac>
<copy todir="${maven.build.testOutputDir}">
<fileset dir="${maven.build.testResourceDir.0}"/>
</copy>
</target>
<!-- ====================================================================== -->
<!-- Run all tests -->
<!-- ====================================================================== -->
<target name="test"
depends="compile-tests, junit-missing"
unless="junit.skipped"
description="Run the test cases">
<mkdir dir="${maven.test.reports}"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="plain" usefile="false"/>
<classpath>
<path refid="build.test.classpath"/>
<pathelement location="${maven.build.outputDir}"/>
<pathelement location="${maven.build.testOutputDir}"/>
</classpath>
<batchtest todir="${maven.test.reports}" unless="test">
<fileset dir="${maven.build.testDir.0}">
<include name="**/Test*.java"/>
<include name="**/*Test.java"/>
<include name="**/*TestCase.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
<batchtest todir="${maven.test.reports}" if="test">
<fileset dir="${maven.build.testDir.0}">
<include name="**/${test}.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-junit-present">
<available classname="junit.framework.Test" property="junit.present" classpathref="build.test.classpath"/>
</target>
<target name="test-junit-status"
depends="test-junit-present">
<condition property="junit.missing">
<and>
<isfalse value="${junit.present}"/>
<isfalse value="${maven.test.skip}"/>
</and>
</condition>
<condition property="junit.skipped">
<or>
<isfalse value="${junit.present}"/>
<istrue value="${maven.test.skip}"/>
</or>
</condition>
</target>
<target name="junit-missing"
depends="test-junit-status"
if="junit.missing">
<echo>=================================== WARNING ===================================</echo>
<echo> JUnit is not present in the test classpath or your $ANT_HOME/lib directory. Tests not executed.</echo>
<echo>===============================================================================</echo>
</target>
<!-- ====================================================================== -->
<!-- Javadoc target -->
<!-- ====================================================================== -->
<target name="javadoc" description="Generates the Javadoc of the application">
<javadoc sourcepath="${maven.build.srcDir.0}"
packagenames="*"
destdir="${maven.reporting.outputDirectory}/apidocs"
access="protected"
old="false"
verbose="false"
version="true"
use="true"
author="true"
splitindex="false"
nodeprecated="false"
nodeprecatedlist="false"
notree="false"
noindex="false"
nohelp="false"
nonavbar="false"
serialwarn="false"
charset="UTF-8"
linksource="false"
breakiterator="false"/>
</target>
<!-- ====================================================================== -->
<!-- Package target -->
<!-- ====================================================================== -->
<target name="package" depends="compile,test" description="Package the application">
<jar jarfile="${maven.build.dir}/${maven.build.finalName}.jar"
compress="true"
index="false"
basedir="${maven.build.outputDir}"
excludes="**/package.html"/>
</target>
<!-- ====================================================================== -->
<!-- A dummy target for the package named after the type it creates -->
<!-- ====================================================================== -->
<target name="jar" depends="package" description="Builds the jar for the application"/>
<!-- ====================================================================== -->
<!-- Download dependencies target -->
<!-- ====================================================================== -->
<target name="test-offline">
<condition property="maven.mode.offline">
<equals arg1="${maven.settings.offline}" arg2="true"/>
</condition>
</target>
<target name="get-deps"
depends="test-offline"
description="Download all dependencies"
unless="maven.mode.offline">
<mkdir dir="${maven.repo.local}"/>
<mkdir dir="${maven.repo.local}/junit/junit/4.11"/>
<get src="https://repo.maven.apache.org/maven2/junit/junit/4.11/junit-4.11.jar"
dest="${maven.repo.local}/junit/junit/4.11/junit-4.11.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/org/hamcrest/hamcrest-core/1.3"/>
<get src="https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
dest="${maven.repo.local}/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/org/hamcrest/hamcrest-library/1.3"/>
<get src="https://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar"
dest="${maven.repo.local}/org/hamcrest/hamcrest-library/1.3/hamcrest-library-1.3.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/eu/eu-emi/security/canl/2.2.1"/>
<get src="https://repo.maven.apache.org/maven2/eu/eu-emi/security/canl/2.2.1/canl-2.2.1.jar"
dest="${maven.repo.local}/eu/eu-emi/security/canl/2.2.1/canl-2.2.1.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/org/bouncycastle/bcpkix-jdk15on/1.52"/>
<get src="https://repo.maven.apache.org/maven2/org/bouncycastle/bcpkix-jdk15on/1.52/bcpkix-jdk15on-1.52.jar"
dest="${maven.repo.local}/org/bouncycastle/bcpkix-jdk15on/1.52/bcpkix-jdk15on-1.52.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/org/bouncycastle/bcprov-jdk15on/1.52"/>
<get src="https://repo.maven.apache.org/maven2/org/bouncycastle/bcprov-jdk15on/1.52/bcprov-jdk15on-1.52.jar"
dest="${maven.repo.local}/org/bouncycastle/bcprov-jdk15on/1.52/bcprov-jdk15on-1.52.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/commons-io/commons-io/2.4"/>
<get src="https://repo.maven.apache.org/maven2/commons-io/commons-io/2.4/commons-io-2.4.jar"
dest="${maven.repo.local}/commons-io/commons-io/2.4/commons-io-2.4.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/net/jcip/jcip-annotations/1.0"/>
<get src="https://repo.maven.apache.org/maven2/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar"
dest="${maven.repo.local}/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/org/mockito/mockito-core/1.9.5"/>
<get src="https://repo.maven.apache.org/maven2/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5.jar"
dest="${maven.repo.local}/org/mockito/mockito-core/1.9.5/mockito-core-1.9.5.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/org/objenesis/objenesis/1.0"/>
<get src="https://repo.maven.apache.org/maven2/org/objenesis/objenesis/1.0/objenesis-1.0.jar"
dest="${maven.repo.local}/org/objenesis/objenesis/1.0/objenesis-1.0.jar"
usetimestamp="false"
ignoreerrors="true"/>
</target>
</project>

View file

@ -6,18 +6,26 @@ Summary: Virtual Organization Membership Service Java API
License: ASL 2.0
URL: https://wiki.italiangrid.it/VOMS
Source0: https://github.com/italiangrid/%{name}/archive/v%{version}.tar.gz
# These are build instructions for ant generated from the maven
# build instructions using the maven ant plugin.
# These are used for building on EPEL 6 since there is no maven
# available there.
Source1: build.xml
Source2: maven-build.xml
Source3: maven-build.properties
# Disable tests using non-local network interface
Patch0: %{name}-no-local.patch
# Adapt to canl-java version 2.5
Patch1: %{name}-canl-2.5.patch
BuildArch: noarch
BuildRequires: maven-local
BuildRequires: mvn(eu.eu-emi.security:canl) >= 2.5
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(org.mockito:mockito-core)
BuildRequires: mvn(net.jcip:jcip-annotations)
Requires: mvn(eu.eu-emi.security:canl) >= 2.5
BuildRequires: java-devel >= 1:1.6
BuildRequires: jpackage-utils
BuildRequires: ant
BuildRequires: canl-java >= 2.5
Requires: java >= 1:1.6
Requires: jpackage-utils
Requires: canl-java >= 2.5
%description
The Virtual Organization Membership Service (VOMS) is an attribute authority
@ -39,34 +47,49 @@ Virtual Organization Membership Service (VOMS) Java API Documentation.
%setup -q
%patch0 -p1
%patch1 -p1
# Do not create source jars
%pom_remove_plugin org.apache.maven.plugins:maven-source-plugin
# Cobertura no longer in Fedora due to licensing issues
%pom_remove_plugin org.codehaus.mojo:cobertura-maven-plugin
# Remove license plugin
%pom_remove_plugin com.mycila.maven-license-plugin:maven-license-plugin
cp -p %{SOURCE1} .
cp -p %{SOURCE2} .
cp -p %{SOURCE3} .
%build
%mvn_build
export CLASSPATH=$(build-classpath bcprov bcpkix commons-io canl)
# The tests use mockito which is not available in EPEL 6 - skipping tests
%ant -Dbuild.sysclasspath=last -Dmaven.test.skip=true package javadoc
%install
%mvn_install -J target/site/javadoc/apidocs
mkdir -p %{buildroot}%{_javadir}
install -m 644 target/%{name}-%{version}.jar \
%{buildroot}%{_javadir}/%{name}.jar
%files -f .mfiles
%dir %{_javadir}/%{name}
mkdir -p %{buildroot}%{_mavenpomdir}
install -p -m 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
%add_to_maven_depmap org.italiangrid %{name} %{version} JPP %{name}
mkdir -p %{buildroot}%{_javadocdir}/%{name}
cp -pr target/site/apidocs %{buildroot}%{_javadocdir}/%{name}
%post
%update_maven_depmap
%postun
%update_maven_depmap
%files
%{_javadir}/%{name}.jar
%{_mavenpomdir}/JPP-%{name}.pom
%{_mavendepmapfragdir}/%{name}
%doc AUTHORS README.md
%license LICENSE
%files javadoc -f .mfiles-javadoc
%files javadoc
%doc %{_javadocdir}/%{name}
%license LICENSE
%changelog
* Fri Jan 05 2018 Mattias Ellert <mattias.ellert@physics.uu.se> - 3.2.0-5
- Adapt to canl-java 2.5
- Use jcip-annotations for EPEL 7 build
- Create EPEL 6 package using the maven ant plugin
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild