essential-play-code icon indicating copy to clipboard operation
essential-play-code copied to clipboard

Running first example in the book fails

Open ivan-brko opened this issue 4 years ago • 1 comments

On a system with nothing Scala/sbt specific installed, running java --version gives the following:

openjdk 11.0.9.1 2020-11-04
OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.10)
OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.20.10, mixed mode, sharing)

Running the first example results in following:

./sbt.sh 
OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
Getting org.scala-sbt sbt 0.13.11 ...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ivy.util.url.IvyAuthenticator (file:/home/ivan/Projects/Play/essential-play-code/chapter1-hello/sbt-launch.jar) to field java.net.Authenticator.theAuthenticator
WARNING: Please consider reporting this to the maintainers of org.apache.ivy.util.url.IvyAuthenticator
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

:: problems summary ::
:::: WARNINGS
                module not found: org.scala-sbt#sbt;0.13.11

        ==== local: tried

          /home/ivan/.ivy2/local/org.scala-sbt/sbt/0.13.11/ivys/ivy.xml

          -- artifact org.scala-sbt#sbt;0.13.11!sbt.jar:

          /home/ivan/.ivy2/local/org.scala-sbt/sbt/0.13.11/jars/sbt.jar

        ==== typesafe-ivy-releases: tried

          http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.11/ivys/ivy.xml

        ==== Maven Central: tried

          http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.11/sbt-0.13.11.pom

          -- artifact org.scala-sbt#sbt;0.13.11!sbt.jar:

          http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.11/sbt-0.13.11.jar

                ::::::::::::::::::::::::::::::::::::::::::::::

                ::          UNRESOLVED DEPENDENCIES         ::

                ::::::::::::::::::::::::::::::::::::::::::::::

                :: org.scala-sbt#sbt;0.13.11: not found

                ::::::::::::::::::::::::::::::::::::::::::::::


:::: ERRORS
        Server access Error: Connection refused (Connection refused) url=http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.11/ivys/ivy.xml

        SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.11/sbt-0.13.11.pom

        SERVER ERROR: HTTPS Required url=http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.11/sbt-0.13.11.jar


:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-sbt#sbt;0.13.11: not found
Error during sbt execution: Error retrieving required libraries
  (see /home/ivan/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.13.11

ivan-brko avatar Jan 29 '21 09:01 ivan-brko

Fixed it by going inside sbt-launch.jar and changing in properties files "http" to "https" + adding an https route for maven central. Or you can just download scala and sbt by yourself, change versions in each project configuration files and it will probably work fine.

Files changed inside sbt-launch.jar:

sbt/sbt.boot.properties
sbt.boot.properties0.7
sbt.boot.properties0.10.0
sbt.boot.properties0.10.1
sbt.boot.properties0.11.0
sbt.boot.properties0.11.1
sbt.boot.properties0.11.2
sbt.boot.properties0.11.3

How to change? Use winrar, 7zip or other archive manager to open jar (NOT EXTRACTING), modify files in text editor and save (it will probably ask "update archive?", just say yes).

What to change?

  • If you see http change it to https Expample: given string: typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/,[organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext] changed: typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext]

  • if you see maven-central add https route for it Expample: given string: maven-central changed: maven-central: https://repo1.maven.org/maven2

blue-tachikoma avatar Mar 30 '21 21:03 blue-tachikoma