```ruby
require 'travis/build/script/shared/jdk'

module Travis
  module Build
    class Script
      class Clojure < Script
        include Jdk

        DEFAULTS = {
          lein: 'lein',
          jdk:  'default'
        }

        def announce
          super
          sh.cmd "#{lein} version"
        end

        def install
          sh.cmd "#{lein} deps", fold: 'install', retry: true
        end

        def script
          sh.cmd "#{lein} test"
        end

        def cache_slug
          super << '--lein-' << lein
        end

        private

          def lein
            config[:lein].to_s
          end
      end
    end
  end
end
```

Update leiningen on the fly
user
```ruby
require 'travis/build/script/shared/jdk'

module Travis
  module Build
    class Script
      class Clojure < Script
        include Jdk

        DEFAULTS = {
          lein: 'lein',
          jdk:  'default'
        }

        LEIN_VERSION = '2.6.1'

        def configure
          super
          update_lein LEIN_VERSION
        end

        def announce
          super
          sh.cmd "#{lein} version"
        end

        def install
          sh.cmd "#{lein} deps", fold: 'install', retry: true
        end

        def script
          sh.cmd "#{lein} test"
        end

        def cache_slug
          super << '--lein-' << lein
        end

        private

          def lein
            config[:lein].to_s
          end

          def update_lein(version)
            sh.if "! -f $HOME/.lein/self-installs/leiningen-#{version}-standalone.jar" do
              sh.cmd "env LEIN_ROOT=true curl -L -o /usr/local/bin/lein https://raw.githubusercontent.com/technomancy/leiningen/#{version}/bin/lein", echo: true, assert: true, sudo: true
              sh.cmd "rm -rf $HOME/.lein", echo: false
              sh.cmd "lein self-install", echo: true, assert: true
            end
          end
      end
    end
  end
end
```
assistant