2016-04-09 15 views
2

私は今、Akka、Play Framework、Scala、そして構築ツールで比較的小さなプロジェクトを実行しています。しかし、私はこのプロジェクトよりも大きなプロジェクトを構築しており、かなり早く構築されています。しかし今ではしばらくしてプロジェクトをビルドしようとしており、コンパイルには時間がかかります(合計時間:904秒)。sbtのコンパイルには時間がかかります

> ~/nlp-search/code(branch:feature/demo-app-api*) » sbt compile   
> [email protected] [info] Loading project definition from 
> /Users/renienj/nlp-search/code/project [info] Set current project to 
> nlp-search (in build file:/Users/renienj/nlp-search/code/) [info] 
> Compiling 115 Scala sources and 1 Java source to 
> /Users/renienj/nlp-search/code/target/scala-2.11/classes... [warn] 
> /Users/renienj/nlp-search/code/app/api/parsedquery/ParsedQuery.scala:14: 
> imported `format' is permanently hidden by definition of value format 
> in object ParsedQuery [warn] import Sentence.format [warn]   
>^[warn] 
> /Users/renienj/nlp-search/code/app/api/parsedquery/Sentence.scala:14: 
> imported `format' is permanently hidden by definition of value format 
> in object Sentence [warn] import Phrase.format [warn]    
>^[warn] 
> /Users/renienj/nlp-search/code/app/api/parsedquery/Sentence.scala:15: 
> imported `format' is permanently hidden by definition of value format 
> in object Sentence [warn] import Filter.format [warn]    
>^[warn] 
> /Users/renienj/nlp-search/code/app/api/parsedquery/Sentence.scala:16: 
> imported `format' is permanently hidden by definition of value format 
> in object Sentence [warn] import Order.format [warn]    
>^[warn] 
> /Users/renienj/nlp-search/code/app/backend/intelligenceServices/nlp/executor/StreamExecutor.scala:23: 
> abstract type pattern OT is unchecked since it is eliminated by 
> erasure [warn]  case x: OT => [warn]   ^[warn] 
> /Users/renienj/nlp-search/code/app/backend/intelligenceServices/merchRules/io/DAO.scala:27: 
> method newTermName in trait Names is deprecated: Use TermName instead 
> [warn]  String.valueOf(x.map(x => x.toChar)).unpickle[MerchRule] 
> [warn]             ^[warn] 
> /Users/renienj/nlp-search/code/app/backend/solrAccess/cache/SolrCacheProvider.scala:24: 
> method newTermName in trait Names is deprecated: Use TermName instead 
> [warn]  x.pickle.value [warn]  ^[warn] 
> /Users/renienj/nlp-search/code/app/backend/solrAccess/cache/SolrCacheProvider.scala:30: 
> method newTermName in trait Names is deprecated: Use TermName instead 
> [warn]  BinaryPickle(x).unpickle[DocumentList] [warn]    
>^[warn] there were 9 feature warnings; re-run with -feature for 
> details [warn] 9 warnings found [success] Total time: 904 s, completed 
> Apr 9, 2016 5:07:09 PM 

マイbuild.sbt:

name := """nlp-search""" 

version := """3.0-RC1""" 

lazy val root = (project in file(".")).enablePlugins(PlayScala) 

scalaVersion := "2.11.7" 

resolvers += Resolver.mavenLocal 

val akkaVersion = "2.3.12" 

libraryDependencies ++= Seq(
    "com.typesafe.akka"  %% "akka-actor"  % akkaVersion, 
    "com.typesafe.akka"  %% "akka-contrib"  % akkaVersion, 
    "com.typesafe.akka"  %% "akka-remote"  % akkaVersion, 
    "com.typesafe.akka"  %% "akka-cluster"  % akkaVersion, 
    "com.typesafe.akka"  %% "akka-testkit"  % akkaVersion, 
    "org.apache.solr"  % "solr-solrj"  % "4.10.0", 
    "org.apache.thrift"  % "libthrift"   % "0.9.2", 
    "org.json"    % "json"    % "20080701", 
    "org.skife.com.typesafe.config" % "typesafe-config" % "0.3.0", 
    "net.debasishg"   %% "redisclient"  % "2.13", 
    "org.scala-lang.modules" %% "scala-pickling" % "0.10.0", 
    "edu.stanford.nlp"  % "stanford-parser" % "3.5.2", 
    "edu.stanford.nlp" % "stanford-corenlp" % "3.5.2", 
    "org.scalatest"   % "scalatest_2.11" % "2.2.4" % "test", 
    "com.kohls.search.qp" % "api"    % "1.0.0", 
    "com.typesafe.akka"  %% "akka-stream-experimental" % "1.0" 
) 

libraryDependencies += specs2 % Test 

resolvers += "scalaz-bintray" at "https://dl.bintray.com/scalaz/releases" 

publishArtifact in (Compile, packageDoc) := false 

publishArtifact in packageDoc := false 

sources in (Compile,doc) := Seq.empty 

私は朝から苦労しています。私は本当になぜそれが長くかかるのか理解できません。

ありがとうございます。

+1

JSONリーダーとライターを大量に生成しているマクロインプリシットがたくさん含まれていますか?私は殺人者だった。私は暗黙のうちにキャッシュし、ビルド時間を5分から30秒に短縮しました。 –

+0

はい、複雑なJSONを生成するための8つの方法があります。試してみることができますか?形のないライブラリを使いましたか?ご意見ありがとうございます。 – Renien

+1

私はアップキックとbsonpickleを使用しています。私は事前計算し、すべての私の含意を次のようにキャッシュします: 'オブジェクトJsonSerialization {暗黙の遅延val userReader = {val userReader =();マクロR [ユーザー]}; ...} ' –

答えて

2

答えはありませんが、ヒントかもしれません...マクロアプリケーション(通常はJSONリーダーや独自のケースクラスのライターなど)によって生成される暗黙的な内容が多い場合、コンパイルがかなり遅くなることがあります。あなたは(upickleでの例)このようなもので暗黙自分自身をキャッシュ試すことができます。

object JsonSerialization { 
    implicit lazy val userReader = { val userReader =(); macroR[User] } 
    implicit lazy val userWriter = { val userWriter =(); macroR[Writer] } 
} 

あなたはまた、型崩れのcachedImplicitを見て、またthis questionで言及さを持っている場合があります。

関連する問題