diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..3060067
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,28 @@
+name: CI
+on: [push, pull_request]
+jobs:
+ build:
+ name: Build and Test (${{ matrix.os }} / OpenJDK ${{ matrix.jdk }})
+ strategy:
+ fail-fast: true
+ matrix:
+ jdk: ['8']
+ os: [ubuntu-latest]
+ runs-on: ${{ matrix.os }}
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up JDK ${{ matrix.jdk }}
+ uses: actions/setup-java@v3
+ with:
+ java-version: ${{ matrix.jdk }}
+ distribution: 'temurin'
+ - name: Cache Maven packages
+ uses: actions/cache@v3
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Maven Build
+ run: mvn clean package -DskipTests
+ - name: Test
+ run: mvn verify
diff --git a/.gitignore b/.gitignore
index 42d15f4..e06bcfb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,2 @@
-build/
-.*
+target/
!.gitignore
diff --git a/VERSION.txt b/VERSION.txt
deleted file mode 100644
index 266146b..0000000
--- a/VERSION.txt
+++ /dev/null
@@ -1 +0,0 @@
-1.6.3
diff --git a/build.properties.xml b/build.properties.xml
deleted file mode 100644
index 4ecc28a..0000000
--- a/build.properties.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- existdb-saml
- SAML implementation for existdb
- 1.6.3
- http://exist-db.org/xquery/exsaml
- beta
- rwxr-xr-x
- https://exist-db.org/
-
-
diff --git a/build.xml b/build.xml
deleted file mode 100644
index 95aede0..0000000
--- a/build.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/collection.xconf b/collection.xconf
deleted file mode 100644
index a871791..0000000
--- a/collection.xconf
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/expath-pkg.xml.tmpl b/expath-pkg.xml.tmpl
deleted file mode 100644
index a67f499..0000000
--- a/expath-pkg.xml.tmpl
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- @name@
-
-
-
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..611cb40
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,104 @@
+
+
+
+ 4.0.0
+
+
+ org.exist-db
+ exist-apps-parent
+ 1.12.0
+
+
+
+ org.exist-db.apps
+ existdb-saml-xquery
+ 1.7.0-SNAPSHOT
+
+
+ eXist-db SAML XQuery
+ SAML v2.0 Implementation in XQuery
+ https://github.com/eXist-db/existdb-saml
+
+
+ https://github.com/eXist-db/existdb-saml.git
+ scm:git:https://github.com/eXist-db/existdb-saml.git
+ scm:git:https://github.com/eXist-db/existdb-saml.git
+
+
+
+ UTF-8
+ UTF-8
+
+
+ http://exist-db.org/apps/exsaml
+
+ 6.0.1
+
+
+
+
+
+ src/main/xar-resources
+ false
+
+
+ src/main/xar-resources-filtered
+ true
+
+
+
+
+
+ src/test/resources
+ false
+
+
+ src/test/resources-filtered
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+
+ ro.kuberam.maven.plugins
+ kuberam-expath-plugin
+
+
+ create-xar
+ package
+
+ make-xar
+
+
+ xar-assembly.xml
+ ${package-final-name}
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+
+ forked-path
+
+ true
+ @{project.version}
+
+
+
+
+
+
diff --git a/post-install.xql b/post-install.xql
deleted file mode 100644
index 92792cd..0000000
--- a/post-install.xql
+++ /dev/null
@@ -1,6 +0,0 @@
-xquery version "3.1";
-
-(: the target collection into which the app is deployed :)
-declare variable $target external;
-
-sm:chmod(xs:anyURI($target||'/saml-request-ids'), 'rwx------')
diff --git a/repo.xml.tmpl b/repo.xml.tmpl
deleted file mode 100644
index 07ba920..0000000
--- a/repo.xml.tmpl
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
- @description@
- @website@
- @status@
- LGPL 2.1
- true
- library
- existdb-saml
-
- post-install.xql
-
-
diff --git a/saml-request-ids/KEEPME b/saml-request-ids/KEEPME
deleted file mode 100644
index a1b0291..0000000
--- a/saml-request-ids/KEEPME
+++ /dev/null
@@ -1 +0,0 @@
-just to keep this dir
\ No newline at end of file
diff --git a/content/clean-reqids.xql b/src/main/xar-resources/clean-reqids.xq
similarity index 100%
rename from content/clean-reqids.xql
rename to src/main/xar-resources/clean-reqids.xq
diff --git a/index.html b/src/main/xar-resources/index.html
similarity index 100%
rename from index.html
rename to src/main/xar-resources/index.html
diff --git a/content/config-exsaml.xml b/src/main/xar-resources/modules/config-exsaml.xml
similarity index 100%
rename from content/config-exsaml.xml
rename to src/main/xar-resources/modules/config-exsaml.xml
diff --git a/content/exsaml.xqm b/src/main/xar-resources/modules/exsaml.xqm
similarity index 100%
rename from content/exsaml.xqm
rename to src/main/xar-resources/modules/exsaml.xqm
diff --git a/src/main/xar-resources/post-install.xq b/src/main/xar-resources/post-install.xq
new file mode 100644
index 0000000..f519d3e
--- /dev/null
+++ b/src/main/xar-resources/post-install.xq
@@ -0,0 +1,18 @@
+xquery version "3.1";
+
+import module namespace sm = "http://exist-db.org/xquery/securitymanager";
+import module namespace xmldb = "http://exist-db.org/xquery/xmldb";
+
+(: the target collection into which the app is deployed :)
+declare variable $target external;
+
+declare variable $saml-request-ids-collection-name := "saml-request-ids";
+declare variable $saml-request-ids-collection-path := $target || "/" || $saml-request-ids-collection-name;
+
+let $_ :=
+ if (fn:not(xmldb:collection-available($saml-request-ids-collection-path)))
+ then
+ xmldb:create-collection($target, $saml-request-ids-collection-name)
+ else()
+return
+ sm:chmod(xs:anyURI($saml-request-ids-collection-path), "rwx------")
diff --git a/content/scheduler.xql b/src/main/xar-resources/scheduler.xq
similarity index 100%
rename from content/scheduler.xql
rename to src/main/xar-resources/scheduler.xq
diff --git a/xar-assembly.xml b/xar-assembly.xml
new file mode 100644
index 0000000..625b318
--- /dev/null
+++ b/xar-assembly.xml
@@ -0,0 +1,43 @@
+
+
+ ${package-title}
+ ${project.organization.name}
+ ${project.description}
+ ${project.url}
+ GNU LGPL 2.1
+ true
+
+ library
+
+ stable
+
+ ${project.artifactId}
+
+
+
+
+ ${package-abbrev}
+
+ post-install.xq
+
+
+
+
+ ${project.build.outputDirectory}
+
+
+ ${project.basedir}
+
+ README.md
+
+
+
+ ${project.basedir}
+
+ LICENSE
+
+
+
+
+