Build DSpace CRIS 7 with broken 3rd party maven repos - kshepherd/dspace-howtos Wiki

Sometimes 3rd party artifacts hosted by jboss or Atlassian will cause an error during DSpace CRIS build - these remote repositories have been returning 503 or 404 errors in June 2022, for example, for jai-core and jai-codec artifacts.

Working around 503 errors with jai-core and jai-codec from jboss:

These artifacts are dependencies of Apache FOP.

A workaround is to download the JARs manually (it's only the POM files that have errors being served) and install them with mvn install and then exclude them from the FOP dependency in the dspace-api pom.xml.

Ideally, we'd find a working maven mirror but the only ones I've found so far also throw errors (eg Atlassian).

1. Find the artifacts in maven central and download the JARs

You can get them from maven central at these links: jai-core and jai-codec

Install the artifacts, where /path/to/... is the path you saved the JAR:

mvn install -Dfile=/path/to/jai-core-1.1.3.jar -DgroupId=javax.media -DartifactId=jai-core -Dversion=1.1.3 -Dpackaging=jar
mvn install -Dfile=/path/to/jai-codec-1.1.3.jar -DgroupId=com.sun.media -DartifactId=jai-codec -Dversion=1.1.3 -Dpackaging=jar

Note that both javax.media and com.sun.media seem to be groupIds / packages associated with these artifacts. I'm not sure if they're interchangeable, whether both should be installed just in case, or not... but the references in other FOP mailing list discussions I saw referred to the above group / artifact combos and this seems to work for me, though I did install jai-core with both groupIds at one stage.

2. Find the "fop" dependency in dspace-api/pom.xml and add the jai-core and jai-codec artifacts as exclusions:

<dependency>
    <groupId>org.apache.xmlgraphics</groupId>
    <artifactId>fop</artifactId>
    <version>2.5</version>
    <exclusions>
        <exclusion>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
        </exclusion>
        <exclusion>
            <groupId>javax.media</groupId>
            <artifactId>jai-core</artifactId>
        </exclusion>
        <exclusion>
            <groupId>com.sun.media</groupId>
            <artifactId>jai-codec</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Make sure these excluding groupId and artifactId references match the JARs you installed locally. You'll need both jai-core and jai-codec installed locally and excluded here to avoid Maven trying to download it from jboss.

Note: I haven't actually tested this with the DocumentCheck class that uses FOP - there could be some breakages there, I was mainly concerned with completing a build and bringing up 7.x successfully

⚠️ **GitHub.com Fallback** ⚠️