`grailsw compile` stopped working

Hi all,

I have a setup that used to work for at least a couple of years without any issues. In my latest update, all of a sudden I am getting the following error:

#!/bin/bash -eo pipefail
./grailsw compile
You must be connected to the internet the first time you use the Grails wrapper
org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 3; The element type "hr" must be terminated by the matching end-tag "</hr>".
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1473)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1749)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2967)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
	at grails.init.Start.getVersion(Start.java:36)
	at grails.init.Start.main(Start.java:83)

Exited with code exit status 1
CircleCI received exit code 1

And basically, I am getting the same error for any grailsw command.

Here is my config file:

version: 2.0
references:
  defaults: &defaults
    docker:
      - image: circleci/openjdk:8-jdk
    working_directory: ~/priz-be

  remote_docker: &remote_docker
    setup_remote_docker:
      docker_layer_caching: false

  assemble_prod: &assemble_prod
    run:
      name: Assemble
      command: ./gradlew -Dgrails.env=prod assemble

  build_and_push_docker_image: &build_and_push_docker_image
    run:
      name: Build docker image
      command: |
        sudo apt-get update --fix-missing
        sudo apt-get install python-pip python-dev
        sudo pip install awscli
        cp -p build/libs/priz-be-0.1.war docker/app.war
        aws ecr get-login --no-include-email --region us-west-2 | sh
        docker build -t priz-be docker
        docker tag priz-be:latest 922556357703.dkr.ecr.us-west-2.amazonaws.com/priz-be:prod-$CIRCLE_SHA1
        docker push 922556357703.dkr.ecr.us-west-2.amazonaws.com/priz-be:prod-$CIRCLE_SHA1

jobs:
  checkout_code:
    <<: *defaults
    steps:
      - checkout

      - run:
          name: Show current branch
          command: echo ${CIRCLE_BRANCH}

      - save_cache:
          key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
          paths:
            - ~/priz-be

  compile:
    <<: *defaults
    steps:
      - restore_cache:
          keys:
            - v1-repo-{{ .Environment.CIRCLE_SHA1 }}
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "build.gradle" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-
      - run:
          name: Compile the project
          command: ./grailsw compile

      # Cache local dependencies if they don't exist
      - save_cache:
          paths:
            - ~/.gradle
          key: v1-dependencies-{{ checksum "build.gradle" }}

  test_and_check:
    <<: *defaults
    steps:
      - restore_cache:
          keys:
            - v1-repo-{{ .Environment.CIRCLE_SHA1 }}
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "build.gradle" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-
      - run:
          name: Testing
          command: ./grailsw test-app

      - run:
          name: Executing stylecheck
          command: ./gradlew check

      - store_artifacts:
          path: ./build/reports/codenarc
          destination: codenarc-report

      - store_test_results:
          path: ./build/test-results/test

      - store_artifacts:
          path: ./build/reports/tests
          destination: test-report

  deploy_to_prod:
    <<: *defaults
    steps:
      - restore_cache:
          keys:
            - v1-repo-{{ .Environment.CIRCLE_SHA1 }}
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "build.gradle" }}
            # fallback to using the latest cache if no exact match is found
            - v1-dependencies-

      - *assemble_prod
      - *remote_docker
      - *build_and_push_docker_image

      - add_ssh_keys:
          fingerprints:
            - "9c:0c:ce:67:62:74:f1:d7:aa:b4:46:55:56:51:e5:f7"

      - run:
          name: Deploy
          command: |
            sudo apt-get update
            sudo apt-get -y install gettext-base
            sudo apt-get clean
            envsubst < docker/deploy-prod.sh.template > docker/deploy-prod.sh
            ssh -v -o StrictHostKeyChecking=no root@178.128.78.7 "bash -s" -- < ./docker/deploy-prod.sh

workflows:
  version: 2

  build-and-test:
    jobs:
      - checkout_code
      - compile:
          requires:
            - checkout_code
      - test_and_check:
          requires:
            - compile
      - deploy_to_prod:
          requires:
            - test_and_check
          filters:
            branches:
              only: master

If I log in with SSH, and trying to execute the same thing by hand, I am getting the same error. Also, checked if there is a network connection. All good…

What can be the reason for this error?

Hi there,

Thank you for your query!

I did note that an upstream change in the Grails Framework Artifactory instance was updated to redirect traffic over https while the grails-wrapper.jar is hard-coded to use http :

It does look like there’s already a PR for the fix though it doesn’t look to be merged right now. In the mean time it does appear that there’s a manual fix outlined in the blog post above involving replacing the grails-wrapper.jar file in your existing project.

Please check out the workaround above and follow the GitHub issue for updates.

Cheers,
Al