3

I have been successfully building DSpace 6.3 in Docker for about 4 months. Today I came across a build error for which no amount of Googling seems to help.

    #9 43.60 [INFO] ------------------------------------------------------------------------
    #9 43.60 [INFO] Reactor Summary for DSpace Assembly and Configuration 6.3:
    #9 43.60 [INFO]
    #9 43.60 [INFO] DSpace Addon Modules ............................... SUCCESS [  0.673 s]
    #9 43.60 [INFO] UTS Library DSpace copyright ....................... SUCCESS [  3.754 s]
    #9 43.60 [INFO] DSpace Kernel :: Additions and Local Customizations  SUCCESS [  1.287 s]
    #9 43.60 [INFO] UTS Library DSpace taglib .......................... SUCCESS [  0.239 s]
    #9 43.60 [INFO] DSpace JSP-UI :: Local Customizations .............. SUCCESS [ 10.128 s]
    #9 43.61 [INFO] DSpace REST :: Local Customizations ................ SUCCESS [  7.058 s]
    #9 43.61 [INFO] DSpace SWORD v2 :: Local Customizations ............ SUCCESS [ 17.577 s]
    #9 43.61 [INFO] Apache Solr Webapp ................................. FAILURE [  0.214 s]
    #9 43.61 [INFO] DSpace OAI-PMH :: Local Customizations ............. SKIPPED
    #9 43.61 [INFO] DSpace Assembly and Configuration .................. SKIPPED
    #9 43.61 [INFO] ------------------------------------------------------------------------
    #9 43.61 [INFO] BUILD FAILURE
    #9 43.61 [INFO] ------------------------------------------------------------------------
    #9 43.61 [INFO] Total time:  41.269 s
    #9 43.61 [INFO] Finished at: 2021-04-06T02:47:50Z
    #9 43.61 [INFO] ------------------------------------------------------------------------
    #9 43.61 [ERROR] Failed to execute goal on project dspace-solr: Could not resolve dependencies for
 project org.dspace:dspace-solr:war:6.3: Failed to collect dependencies at org.apache.solr:solr-
core:jar:4.10.4 -> org.restlet.jee:org.restlet:jar:2.1.1: Failed to read artifact descriptor for 
org.restlet.jee:org.restlet:jar:2.1.1: Could not transfer artifact org.restlet.jee:org.restlet:pom:2.1.1 
from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [maven-snapshots 
(http://oss.sonatype.org/content/repositories/snapshots, default, snapshots), maven-restlet 
(http://maven.restlet.org, default, releases+snapshots), apache.snapshots 
(http://repository.apache.org/snapshots, default, disabled)] -> [Help 1]
    #9 43.61 [ERROR]

As the error message says org.restlet.jee is a dependency of org.apache.solr.core-services solr-core-4.10.4.jar and is listed in that jar's pom file. Which seems to be the only reference to it in the maven cascade of pom files as far as I can tell.

I have not come across this "Blocked mirror for repositories" error before and a google of "maven "Blocked mirror for repositories"" is particularly unhelpful. Presumably, the repository that this dependency is registered for has somehow got itself onto a blacklist.

I tried adding the dependency manually to the DSpace Solr pom.xml file, but this doesn't work. Does anyone know a workaround or is it a matter of making a request to Apache Solr team to fix it?

  • If you landed this page because of Ranger compilation error, manually download Maven 3.6.3 which is last version of Maven without HTTP blocker. Hopefully in near future all poms will update their URLs to use HTTPS. – dz902 Nov 19 '21 at 02:54

4 Answers4

4

Maven version 3.81 released last week no longer accepts http:// repositories, only https:// - https://www.reddit.com/r/java/comments/mk462r/apache_maven_version_381_released/ .

The part of the error message:

Could not transfer artifact org.restlet.jee:org.restlet:pom:2.1.1 
from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories

means that 0.0.0.0 (i.e. all IPs) are blocked for http. The message is a bit cryptic. You'd think the programmers could have given something a little more helpful.

The Docker image we were using to build was maven:3-jdk-8 which was updated to Maven 3.81 a few days ago. So, as soon as Docker updated its image we were no longer able to access http:// repositories. We changed our Maven Docker image to the previous version - 3.6-jdk-8 - and DSpace 6.3 builds fine.

There is no doubt a way to override the default behavior in Maven 3.81 but we are fine with using the older version for now.

2

This may be a temporary issue, if the old Restlet repository is down/unavailable temporarily.

However, another possible workaround is to add this temporarily to the main POM [src]/pom.xml in the <repositories> tag:

<repository>
  <id>maven-restlet</id>
  <name>Public online Restlet repository</name>
  <url>https://maven.restlet.com</url>
</repository>

We ran into this a while back in DSpace 7 work (see https://github.com/DSpace/DSpace/pull/2642), but it turned out to only be needed temporarily as the issue was that the older http://maven.restlet.org URL was temporarily unresponsive.

Tim Donohue
  • 542
  • 4
  • 14
  • Thanks. I actually tried that and it didn't help. However, I did find the answer, Maven 3.81 no longer accepts repositoriesover http, only https. See below. – bgs_uts_lib Apr 09 '21 at 03:22
1

In \apache-maven-3.8.1\conf\settings.xml it was necessary to define where the maven would mirror from. That was the problem in my case.

< mirrorOf> external:*http < mirrorOf>

The solution:

< mirrorOf> external:http://yourlocalhost:8080 < mirrorOf>

0

So, it took me all day and I tried dozens of things but I solved it.

I was initially trying to force the dependency in the wrong pom.xml file. The only way I could get it to build is by:

  1. Create a new Solr local customisation module in your customisations project and add a pom.xml file. If you don't have a customisations project and are using plain vanilla DSpace, I guess you'll have to create one. For me, the new customisation module was at ${customisations.project.root}/src/dspace/modules/solr and the POM file is:

     <modelVersion>4.0.0</modelVersion>
     <groupId>org.dspace.modules</groupId>
     <artifactId>solr</artifactId>
     <packaging>war</packaging>
     <name>DSpace Solr :: Local Customizations</name>
     <description>
         This project allows you to overlay your own local Solr customizations
         on top of the default Solr web application provided with DSpace.
     </description>
    
     <parent>
         <groupId>org.dspace</groupId>
         <artifactId>modules</artifactId>
         <version>6.3</version>
         <relativePath>..</relativePath>
     </parent>
    
     <properties>
         <!-- This is the path to the root [dspace-src] directory. -->
         <root.basedir>${basedir}/../../..</root.basedir>
         <dspace.maven.local>/dspace-src/dspace/maven-local</dspace.maven.local>
     </properties>
    
     <dependencies>
    
         <dependency>
             <groupId>org.restlet.jee</groupId>
             <artifactId>org.restlet</artifactId>
             <version>2.1.1</version>
             <scope>system</scope>
             <systemPath>${dspace.maven.local}/org/restlet/jee/org.restlet/2.1.1/org.restlet-2.1.1.jar</systemPath>
         </dependency>
    
     </dependencies>
    

(Note - I couldn't get stackoverflow to display the root project element in the above code - probably because it had XML namespace declares in it)

  1. Copy the org.restlet.jee package from your local Maven repository into a directory within your DSpace customisations project. In the above code you can see mine was located at ${dspace.maven.local}/org/restlet/jee/org.restlet/2.1.1/org.restlet-2.1.1.jar and I declared the `${dspace.maven.local} variable to point to the directory I created for teh purpose.

You cannot simply use the declaration from the Maven repository - https://mvnrepository.com/artifact/org.restlet.jee/org.restlet/2.1.1 - as the file does not exist in that repository, which may have been the problem all along, who knows?

You cannot declare the dependency in pom.xml files higher in the directory structure - doesn't work. You cannot install using maven install:install-file in your Dockerfile - doesn't work.

Hope this helps anyone who comes across the same problem.

  • OK. So I spoke too soon. This allows the project to build but then DSpace fails to run as I should have copied the `pom.xml` file from `/[root]/dspace/modules/solr`. However, when you do that and add the dependency as above, you revert to the same "Blocked mirror for repositories" error when building. Help please. – bgs_uts_lib Apr 07 '21 at 01:25