古いPlay2を動かす方法

play 開発関連
スポンサーリンク

JDKを8から12にしてSBT1.2.8にして、いろいろあってivy2のcacheを消してしまったら、古いPlay2.3ベースのプロジェクトがコンパイルできなくなって困ったので対処法を残しておきます。数年に一回こんなことが起こってる気が・・・

sbt clean build時にでたエラー

$ sbt clean compile
[info] Loading global plugins from /Users/hoge/.sbt/0.13/plugins
[info] Updating {file:/Users/hoge/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Loading project definition from /Users/hogs/Documents/hoge-project/project
[info] Updating {file:/Users/hoge/Documents/hoge-project/project/}hoge-project-build...
[info] Resolving org.codehaus.plexus#plexus-utils;3.0.17 ...
[error] Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.typesafe.com/typesafe/ivy-releases/org.codehaus.plexus/plexus-utils/3.0.17/ivys/ivy.xml
[error] Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.codehaus.plexus/plexus-utils/3.0.17/ivys/ivy.xml
[info] Resolving org.codehaus.plexus#plexus-component-annotations;1.5.5 ...
[error] Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.typesafe.com/typesafe/ivy-releases/org.codehaus.plexus/plexus-component-annotations/1.5.5/ivys/ivy.xml
[error] Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.codehaus.plexus/plexus-component-annotations/1.5.5/ivys/ivy.xml
[info] Resolving javax.enterprise#cdi-api;1.0 ...
[error] Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.typesafe.com/typesafe/ivy-releases/javax.enterprise/cdi-api/1.0/ivys/ivy.xml
[error] Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/javax.enterprise/cdi-api/1.0/ivys/ivy.xml
[info] Resolving org.codehaus.plexus#plexus-classworlds;2.5.1 ...
[error] Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.typesafe.com/typesafe/ivy-releases/org.codehaus.plexus/plexus-classworlds/2.5.1/ivys/ivy.xml
[error] Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.codehaus.plexus/plexus-classworlds/2.5.1/ivys/ivy.xml
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project tohoge-project (in build file:/Users/hoge/Documents/hoge-project/)
[success] Total time: 1 s, completed 2019/05/13 23:03:59
[info] Updating {file:/Users/hoge/Documents/hoge-project/}base...
[info] Resolving com.typesafe.netty#netty-http-pipelining;1.1.2 ...
[error] Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.typesafe.com/typesafe/releases/com/typesafe/netty/netty-http-pipelining/1.1.2/netty-http-pipelining-1.1.2.pom
[warn] 	module not found: com.typesafe.netty#netty-http-pipelining;1.1.2
[warn] ==== local: tried
[warn]   /Users/hoge/.ivy2/local/com.typesafe.netty/netty-http-pipelining/1.1.2/ivys/ivy.xml
[warn] ==== local-preloaded-ivy: tried
[warn]   /Users/hoge/.sbt/preloaded/com.typesafe.netty/netty-http-pipelining/1.1.2/ivys/ivy.xml
[warn] ==== local-preloaded: tried
[warn]   file:////Users/hoge/.sbt/preloaded/com/typesafe/netty/netty-http-pipelining/1.1.2/netty-http-pipelining-1.1.2.pom
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/com/typesafe/netty/netty-http-pipelining/1.1.2/netty-http-pipelining-1.1.2.pom
[warn] ==== Typesafe Releases Repository: tried
[warn]   https://repo.typesafe.com/typesafe/releases/com/typesafe/netty/netty-http-pipelining/1.1.2/netty-http-pipelining-1.1.2.pom
[warn] ==== scalaz-bintray: tried
[warn]   http://dl.bintray.com/scalaz/releases/com/typesafe/netty/netty-http-pipelining/1.1.2/netty-http-pipelining-1.1.2.pom
[info] Resolving org.ow2#ow2;1.3 ...
[error] Server access Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target url=https://repo.typesafe.com/typesafe/releases/org/ow2/asm/asm-parent/4.1/asm-parent-4.1.jar
[info] Resolving jline#jline;2.12.1 ...
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	::          UNRESOLVED DEPENDENCIES         ::
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	:: com.typesafe.netty#netty-http-pipelining;1.1.2: not found
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn] 	Note: Unresolved dependencies path:
[warn] 		com.typesafe.netty:netty-http-pipelining:1.1.2
[warn] 		  +- com.typesafe.play:play_2.11:2.3.9 ((play.PlaySettings) PlaySettings.scala#L78)
[warn] 		  +- com.typesafe.play:play-docs_2.11:2.3.9 ((play.PlaySettings) PlaySettings.scala#L89)
[warn] 		  +- base:base_2.11:1.0-SNAPSHOT
sbt.ResolveException: unresolved dependency: com.typesafe.netty#netty-http-pipelining;1.1.2: not found
	at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:291)
	at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:188)
	at sbt.IvyActions$$anonfun$updateEither$1.apply(IvyActions.scala:165)
	at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
	at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:155)
	at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:132)
	at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:57)
	at sbt.IvySbt$$anon$4.call(Ivy.scala:65)
	at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
	at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
	at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
	at xsbt.boot.Using$.withResource(Using.scala:10)
	at xsbt.boot.Using$.apply(Using.scala:9)
	at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
	at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
	at xsbt.boot.Locks$.apply0(Locks.scala:31)
	at xsbt.boot.Locks$.apply(Locks.scala:28)
	at sbt.IvySbt.withDefaultLogger(Ivy.scala:65)
	at sbt.IvySbt.withIvy(Ivy.scala:127)
	at sbt.IvySbt.withIvy(Ivy.scala:124)
	at sbt.IvySbt$Module.withModule(Ivy.scala:155)
	at sbt.IvyActions$.updateEither(IvyActions.scala:165)
	at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1369)
	at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1365)
	at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$87.apply(Defaults.scala:1399)
	at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$87.apply(Defaults.scala:1397)
	at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:37)
	at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1402)
	at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1396)
	at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:60)
	at sbt.Classpaths$.cachedUpdate(Defaults.scala:1419)
	at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1348)
	at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1310)
	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
	at sbt.std.Transform$$anon$4.work(System.scala:63)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.Execute.work(Execute.scala:235)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[error] (base/*:update) sbt.ResolveException: unresolved dependency: com.typesafe.netty#netty-http-pipelining;1.1.2: not found
[error] Total time: 22 s, completed 2019/05/13 23:04:21

対処方法

Javaで証明書エラーがでているので、信頼済みホストに追加する必要があります。

JAVA_HOMEをJDK8に戻す

「.bash_profile」のJAVA_HOMEを変えます。例はmacの場合で、設定後ターミナルの再起動をします。

$ vi ~/.bash_profile

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

信頼済みホストを追加

エラーがでていた「repo.typesafe.com」を信頼済みホストに追加します。その際には以下のツールを使うと簡単です。

利用方法は簡単で、ソースをダウンロード後にJavaでコンパイルして実行するだけです。
「repo.typesafe.com」を追加した際の手順です。

$ javac InstallCert.java
$ java InstallCert repo.typesafe.com

$ keytool -exportcert -alias repo.typesafe.com-1 -keystore jssecacerts -storepass changeit -file repo.typesafe.com-1.cer

$ sudo keytool -importcert -alias repo.typesafe.com -keystore $JAVA_HOME/Contents/Home/jre/lib/security/cacerts -storepass changeit -file repo.typesafe.com-1.cer

タイトルとURLをコピーしました