Skip to content

Commit

Permalink
Use official xerces version
Browse files Browse the repository at this point in the history
  • Loading branch information
mlocati committed Nov 18, 2023
1 parent c9e02cd commit b5ef1e5
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
java-version: '17'
distribution: temurin
cache: maven
-
name: Install Xerces with XSD 1.1 support in local M2 repository
run: ./install-xerces-m2.sh
-
name: Update version
if: steps.check-tag.outputs.tag
Expand Down
65 changes: 65 additions & 0 deletions install-xerces-m2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/sh

set -o errexit
set -o nounset

XERCES_VERSION=2.12.2
XMLAPIS_VERSION=1.4.02
XPATH_VERSION=1.2.1
JAVACUP_VERSION=10k
ICU4J_VERSION='4.2'

printf 'Creating temporary directory... '
DOWNLOAD_DIR="$(mktemp -d)"
printf 'done.\n'

printf 'Downloading and extracting xerces... '
curl -sSLf "https://dlcdn.apache.org//xerces/j/binaries/Xerces-J-bin.$XERCES_VERSION-xml-schema-1.1.tar.gz" | tar -xz -C "$DOWNLOAD_DIR" --strip-components=1
printf 'done.\n'

printf 'Installing JARs to local m2 repository\n'

mvn install:install-file \
-Dfile="$DOWNLOAD_DIR/xml-apis.jar" \
-DgroupId=xml-apis \
-DartifactId=xml-apis \
-Dversion=1.4.02 \
-Dpackaging=jar \
-DgeneratePom=true

mvn install:install-file \
-Dfile="$DOWNLOAD_DIR/xercesImpl.jar" \
-DgroupId=xerces \
-DartifactId=xercesImpl \
-Dversion="$XERCES_VERSION" \
-Dclassifier=xml-schema-1.1 \
-Dpackaging=jar \
-DgeneratePom=true

mvn install:install-file \
-Dfile="$DOWNLOAD_DIR/org.eclipse.wst.xml.xpath2.processor_$XPATH_VERSION.jar" \
-DgroupId=org.eclipse.wst.xml \
-DartifactId=xpath2 \
-Dversion="$XPATH_VERSION" \
-Dpackaging=jar \
-DgeneratePom=true

mvn install:install-file \
-Dfile="$DOWNLOAD_DIR/cupv10k-runtime.jar" \
-DgroupId=edu.princeton.cup \
-DartifactId=java-cup \
-Dversion="$JAVACUP_VERSION" \
-Dpackaging=jar \
-DgeneratePom=true

mvn install:install-file \
-Dfile="$DOWNLOAD_DIR/icu4j.jar" \
-DgroupId=com.ibm.icu \
-DartifactId=icu4j \
-Dversion="$ICU4J_VERSION" \
-Dpackaging=jar \
-DgeneratePom=true

printf 'Deleting temporary directory... '
rm -rf "$DOWNLOAD_DIR"
printf 'done.\n'
29 changes: 19 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,20 @@
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
<version>1.4.02</version>
<scope>runtime</scope>
</dependency>
<!-- @see https://blog.adamretter.org.uk/xerces-xsd11-maven/ -->
<dependency>
<groupId>org.exist-db.thirdparty.xerces</groupId>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.12.2</version>
<classifier>xml-schema-1.1</classifier>
<scope>compile</scope>
</dependency>
<!-- xpath2 and java-cup are needed at runtime
for xercesImpl Schema 1.1 support -->
<dependency>
<groupId>org.exist-db.thirdparty.org.eclipse.wst.xml</groupId>
<groupId>org.eclipse.wst.xml</groupId>
<artifactId>xpath2</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
Expand All @@ -53,6 +50,12 @@
<version>10k</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>4.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down Expand Up @@ -86,19 +89,19 @@
<configuration>
<filters>
<filter>
<artifact>xerces:*</artifact>
<artifact>xml-apis:*</artifact>
<excludes>
<exclude>META-INF/*.MF</exclude>
</excludes>
</filter>
<filter>
<artifact>xml-apis:*</artifact>
<artifact>xerces:*</artifact>
<excludes>
<exclude>META-INF/*.MF</exclude>
</excludes>
</filter>
<filter>
<artifact>org.exist-db.thirdparty.*</artifact>
<artifact>org.eclipse.wst.xml:*</artifact>
<excludes>
<exclude>META-INF/*.MF</exclude>
</excludes>
Expand All @@ -109,6 +112,12 @@
<exclude>META-INF/*.MF</exclude>
</excludes>
</filter>
<filter>
<artifact>com.ibm.icu:*</artifact>
<excludes>
<exclude>META-INF/*.MF</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
Expand Down

0 comments on commit b5ef1e5

Please sign in to comment.