diff --git a/.gitignore b/.gitignore
index 32c7b74..45aab53 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@ xmlgraphics-commons-1.3.1-src.tar.gz
/xmlgraphics-commons-1.5-src.tar.gz
/xmlgraphics-commons-2.0-src.tar.gz
/xmlgraphics-commons-2.0.1-src.tar.gz
+/xmlgraphics-commons-2.2-src.tar.gz
diff --git a/sources b/sources
index d227ec8..0c19da9 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-d8b3b07116e5387c760f4fe6dbe598c0 xmlgraphics-commons-2.0.1-src.tar.gz
+SHA512 (xmlgraphics-commons-2.2-src.tar.gz) = c0c786e774da535d7ed100c3c78ba1483fde371b7353226bb72076aab39ad33e752fa9d85fd368f65cfb50cc25ae904868d8f939323ea96876523e09f1259211
diff --git a/xmlgraphics-commons.spec b/xmlgraphics-commons.spec
index 0e40d5d..de29cb7 100644
--- a/xmlgraphics-commons.spec
+++ b/xmlgraphics-commons.spec
@@ -1,22 +1,22 @@
Name: xmlgraphics-commons
-Version: 2.0.1
-Release: 6%{?dist}
+Version: 2.2
+Release: 1%{?dist}
Epoch: 0
Summary: XML Graphics Commons
License: ASL 2.0
URL: http://xmlgraphics.apache.org/
-Source0: http://apache.org/dist/xmlgraphics/commons/source/%{name}-%{version}-src.tar.gz
+Source0: http://archive.apache.org/dist/xmlgraphics/commons/source/xmlgraphics-commons-%{version}-src.tar.gz
BuildArch: noarch
-BuildRequires: java-devel >= 1:1.6.0
-BuildRequires: javapackages-local
-BuildRequires: ant >= 0:1.6
-BuildRequires: ant-junit >= 0:1.6
-BuildRequires: junit
-BuildRequires: apache-commons-io >= 1.3.1
-BuildRequires: apache-commons-logging >= 1.0.4
-BuildRequires: apache-parent
+
+BuildRequires: maven-local
+BuildRequires: mvn(commons-io:commons-io)
+BuildRequires: mvn(commons-logging:commons-logging)
+BuildRequires: mvn(junit:junit)
+BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
+BuildRequires: mvn(org.mockito:mockito-core)
+BuildRequires: mvn(xml-resolver:xml-resolver)
%description
Apache XML Graphics Commons is a library that consists of
@@ -27,35 +27,37 @@ find components such as a PDF library, an RTF library,
Graphics2D implementations that let you generate PDF &
PostScript files, and much more.
-%package javadoc
-Summary: Javadoc for %{name}
-
-%description javadoc
-%{summary}.
+%package javadoc
+Summary: Javadoc for %{name}
+%description javadoc
+This package contains API documentation for %{name}.
%prep
%setup -q %{name}-%{version}
-rm -f `find . -name "*.jar"`
-# create pom from template
-sed "s:@version@:%{version}:g" %{name}-pom-template.pom \
- > %{name}.pom
+find -name "*.jar" -delete
+# Disable plugins not needed for RPM build
+%pom_remove_plugin :maven-checkstyle-plugin
+%pom_remove_plugin :findbugs-maven-plugin
+
+# Make into OSGi bundle
+%pom_xpath_inject pom:project 'bundle'
+%pom_add_plugin org.apache.felix:maven-bundle-plugin . \
+" true
+
+
+ org.apache.xmlgraphics
+
+ "
%build
-export CLASSPATH=$(build-classpath commons-logging)
-export OPT_JAR_LIST="ant/ant-junit junit"
-pushd lib
-ln -sf $(build-classpath commons-io) .
-popd
-ant package javadocs
+%mvn_file : %{name}
+%mvn_build
%install
-%mvn_file : %{name}
-%mvn_artifact %{name}.pom build/%{name}-%{version}.jar
-
-%mvn_install -J build/javadocs
+%mvn_install
%files -f .mfiles
%license LICENSE NOTICE
@@ -64,8 +66,12 @@ ant package javadocs
%files javadoc -f .mfiles-javadoc
%license LICENSE NOTICE
-
%changelog
+* Thu Apr 26 2018 Mat Booth - 0:2.2-1
+- Update to latest release
+- Switch to maven-based build
+- Add OSGi metadata
+
* Fri Feb 09 2018 Fedora Release Engineering - 0:2.0.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild