diff --git a/jna.spec b/jna.spec
index 11aa363..6588d4e 100644
--- a/jna.spec
+++ b/jna.spec
@@ -1,6 +1,9 @@
+# Allow conditionally building without the reflections library
+%bcond_without reflections
+
Name: jna
Version: 4.5.1
-Release: 5%{?dist}
+Release: 6%{?dist}
Summary: Pure Java access to native libraries
# Most of code is dual-licensed under either LGPL 2.1 only or Apache
# License 2.0. WeakIdentityHashMap.java was taken from Apache CXF,
@@ -40,7 +43,9 @@ BuildRequires: ant-junit
BuildRequires: junit
BuildRequires: libX11-devel
BuildRequires: libXt-devel
+%if %{with reflections}
BuildRequires: reflections
+%endif
%description
JNA provides Java programs easy access to native shared libraries
@@ -85,8 +90,15 @@ sed -i 's/\r//' LICENSE
chmod -c 0644 LICENSE OTHERS CHANGES.md
+%if %{with reflections}
sed s,',&,' -i build.xml
build-jar-repository -s -p lib junit reflections ant
+%else
+build-jar-repository -s -p lib junit ant
+rm test/com/sun/jna/StructureFieldOrderInspector.java
+rm test/com/sun/jna/StructureFieldOrderInspectorTest.java
+rm contrib/platform/test/com/sun/jna/platform/StructureFieldOrderTest.java
+%endif
cp lib/native/aix-ppc64.jar lib/clover.jar
@@ -129,6 +141,9 @@ install -m 755 build/native*/libjnidispatch*.so %{buildroot}%{_libdir}/%{name}/
%changelog
+* Thu Mar 07 2019 Mat Booth - 4.5.1-6
+- Allow conditionally building without the reflections library for tests
+
* Fri Feb 01 2019 Fedora Release Engineering - 4.5.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild