构建版本

时间:2015-10-01 09:00:03

标签: scala playframework sbt

我有一个多模块Play(scala)项目。

Scala版本2.11.7

SBT版本0.13.8

项目看起来像这样,非常简化,build.sbt

lazy val root = project.in(file("."))
    .aggregate(lib1, lib2, lib3, lib4, web)
    .settings(scalaVersion := "2.11.7")

lazy val lib1 = Project( "lib1", file("libs/lib1") )
    .settings(
        name := "lib1",
        version := "0.0.1-SNAPSHOT"
    )

lazy val lib2 = Project( "lib2", file("libs/lib2") )
    .settings(
        name := "lib2",
        version := "0.0.1-SNAPSHOT"
    )

lazy val lib3 = Project( "lib3", file("libs/lib3") )
    .dependsOn(lib1)
    .settings(
        name := "lib3",
        version := "0.0.1-SNAPSHOT"
    )

lazy val lib4 = Project( "lib4", file("libs/lib4") )
    .dependsOn(lib1, lib2)
    .settings(
        name := "lib4",
        version := "0.0.1-SNAPSHOT"
    )

// Play framework (2.4.0)
lazy val web = Project( "web", file("modules/web") )
    .dependsOn(lib4, lib3)
    .settings(
        name := "web",
        version := "0.0.1-SNAPSHOT"
    )

当我想发布这个项目时,我首先将所有子模块版本更新为非SNAPSHOT版本。

我遇到的问题是当我做的时候;干净;从项目的根目录编译需要花费很长时间才能编译(Web模块相当大)。 但是,如果我从除modules / web / build.sbt之外的所有版本中删除-SNAPSHOT部分,则编译时间要短得多。

当我删除Web模块中版本的-SNAPSHOT部分时,为什么编译需要更长的时间?

更新

我在Wercker中完成了构建历史记录,我注意到每次构建版本(非快照版本)时,编译都需要很长时间。我现在对此做出反应的原因是,自从项目成长以来,我最终达到了Wercker的超时限制。

更新2

我使用以下命令分析了使用快照版本进行编译而没有:在ThisBuild ++中设置scalacOptions = Seq(“ - Ystatistics”)

在每次测试之前我做了:

sbt
> ;clean;cleanFiles;update
> set scalacOptions in ThisBuild ++= Seq("-Ystatistics")
> compile

测试1,子模块web版本为0.0.1-SNAPSHOT

输出:

[info] Compiling 189 Scala sources and 4 Java sources to theproject/modules/web/target/scala-2.11/classes...
[info] *** Cumulative statistics at phase parser
[info] #created tree nodes           : 230115
[info] #created tree nodes by type   :
[info] #retained tree nodes          : 209100
[info] #retained tree nodes by type  : Ident: 61077, Select: 46661, Apply: 28827, Literal: 15756, ValDef: 12292, : 10016, TypeTree: 7182, TypeApply: 3557, AppliedTypeTree: 3472, Block: 2572, Function: 2514, DefDef: 2464, Import: 1925, CaseDef: 1644, Bind: 1466, If: 1137, This: 857, AssignOrNamedArg: 827, New: 766, Template: 716, : 664, Match: 625, ClassDef: 493, Typed: 329, Assign: 223, ModuleDef: 222, PackageDef: 201, Throw: 200, Annotated: 138, Try: 96, Alternative: 46, TypeDef: 39, SingletonTypeTree: 34, TypeBoundsTree: 27, PostfixSelect: 14, LabelDef: 9, Return: 7, Super: 3, CompoundTypeTree: 1, ExistentialTypeTree: 1
[info] *** Cumulative statistics at phase typer
[info] #symbols                      : 1214062
[info] #created tree nodes by type   :
[info] #unique types                 : 238342
[info] #retained tree nodes          : 511484
[info] #retained tree nodes by type  : Select: 161226, TypeTree: 65234, Ident: 57550, Apply: 46577, This: 38647, Literal: 24049, ValDef: 22046, TypeApply: 21801, : 16189, DefDef: 11589, ApplyToImplicitArgs: 11353, Block: 7201, CaseDef: 3735, Function: 3130, New: 2257, ApplyImplicitView: 2186, Import: 2091, Bind: 1711, Typed: 1701, Template: 1691, Super: 1643, Assign: 1471, If: 1448, ClassDef: 1229, Match: 1153, TypeDef: 804, UnApply: 490, ModuleDef: 462, Throw: 461, PackageDef: 201, Try: 96, Alternative: 46, LabelDef: 9, Return: 7, Annotated: 0, PostfixSelect: 0, AppliedTypeTree: 0, CompoundTypeTree: 0, AssignOrNamedArg: 0, TypeBoundsTree: 0, ExistentialTypeTree: 0, : 0, SingletonTypeTree: 0
[info] #created tree nodes           : 3560271
[info] *** Cumulative statistics at phase patmat
[info] #symbols                      : 1277310
[info] #created tree nodes by type   :
[info] #unique types                 : 158480
[info] #retained tree nodes          : 539180
[info] #retained tree nodes by type  : Select: 165816, TypeTree: 68605, Ident: 65582, Apply: 52370, This: 38663, ValDef: 25078, Literal: 24953, TypeApply: 22484, : 14010, DefDef: 11589, ApplyToImplicitArgs: 11353, Block: 9847, LabelDef: 3654, If: 3447, Function: 3130, New: 2549, ApplyImplicitView: 2186, Import: 2091, Template: 1691, Super: 1643, Typed: 1545, CaseDef: 1485, Assign: 1479, ClassDef: 1229, TypeDef: 804, Throw: 754, ModuleDef: 462, Match: 234, PackageDef: 201, Bind: 141, Try: 96, Return: 7, Alternative: 2, Annotated: 0, PostfixSelect: 0, AppliedTypeTree: 0, CompoundTypeTree: 0, AssignOrNamedArg: 0, TypeBoundsTree: 0, UnApply: 0, ExistentialTypeTree: 0, : 0, SingletonTypeTree: 0
[info] #created tree nodes           : 3652975
[info] *** Cumulative statistics at phase erasure
[info] #symbols                      : 1641045
[info] #created tree nodes by type   :
[info] #unique types                 : 129764
[info] #retained tree nodes          : 843524
[info] #retained tree nodes by type  : Select: 211096, Apply: 135425, TypeTree: 126959, Ident: 65012, This: 64270, ValDef: 41659, DefDef: 32844, : 32381, Literal: 29623, Block: 20309, TypeApply: 18396, New: 12307, ApplyToImplicitArgs: 11184, Typed: 6703, Template: 6676, ClassDef: 6668, Super: 6602, LabelDef: 3654, If: 3429, ArrayValue: 2347, ApplyImplicitView: 1521, Assign: 1504, CaseDef: 1486, Throw: 756, Match: 234, PackageDef: 201, Bind: 142, Try: 97, Import: 12, ApplyDynamic: 11, ModuleDef: 8, Return: 6, Alternative: 2, Annotated: 0, Function: 0, PostfixSelect: 0, AppliedTypeTree: 0, CompoundTypeTree: 0, AssignOrNamedArg: 0, TypeDef: 0, TypeBoundsTree: 0, UnApply: 0, ExistentialTypeTree: 0, : 0, SingletonTypeTree: 0
[info] #created tree nodes           : 4739851
[info] *** Cumulative statistics at phase cleanup
[info] #symbols                      : 1696500
[info] #created tree nodes by type   :
[info] #unique types                 : 147006
[info] #retained tree nodes          : 988250
[info] #retained tree nodes by type  : Select: 247959, Apply: 141911, TypeTree: 139040, Ident: 82559, This: 80156, ValDef: 52195, : 44329, Literal: 40480, DefDef: 36095, Block: 25000, TypeApply: 16619, New: 12414, Assign: 12147, ApplyToImplicitArgs: 11176, If: 6774, Typed: 6706, Template: 6676, ClassDef: 6668, Super: 6602, LabelDef: 3654, Throw: 2946, ArrayValue: 2380, ApplyImplicitView: 1521, CaseDef: 1497, Match: 234, PackageDef: 201, Bind: 153, Try: 108, Return: 28, Import: 12, ModuleDef: 8, Alternative: 2, Annotated: 0, Function: 0, PostfixSelect: 0, AppliedTypeTree: 0, CompoundTypeTree: 0, AssignOrNamedArg: 0, TypeDef: 0, ApplyDynamic: 0, TypeBoundsTree: 0, UnApply: 0, ExistentialTypeTree: 0, : 0, SingletonTypeTree: 0
[info] #created tree nodes           : 5114521
[info] *** Cumulative statistics at phase jvm
[info] #symbols                      : 1719097
[info] #created tree nodes by type   :
[info] #unique types                 : 153319
[info] #retained tree nodes          : 988250
[info] #retained tree nodes by type  : Select: 247959, Apply: 141911, TypeTree: 139040, Ident: 82559, This: 80156, ValDef: 52195, : 44329, Literal: 40480, DefDef: 36095, Block: 25000, TypeApply: 16619, New: 12414, Assign: 12147, ApplyToImplicitArgs: 11176, If: 6774, Typed: 6706, Template: 6676, ClassDef: 6668, Super: 6602, LabelDef: 3654, Throw: 2946, ArrayValue: 2380, ApplyImplicitView: 1521, CaseDef: 1497, Match: 234, PackageDef: 201, Bind: 153, Try: 108, Return: 28, Import: 12, ModuleDef: 8, Alternative: 2, Annotated: 0, Function: 0, PostfixSelect: 0, AppliedTypeTree: 0, CompoundTypeTree: 0, AssignOrNamedArg: 0, TypeDef: 0, ApplyDynamic: 0, TypeBoundsTree: 0, UnApply: 0, ExistentialTypeTree: 0, : 0, SingletonTypeTree: 0
[info] #created tree nodes           : 5114554
[warn] 7 warnings found
[success] Total time: 150 s, completed Oct 1, 2015 3:58:50 PM

测试2,版本为0.0.1的子模块web

输出:

[info] Compiling 189 Scala sources and 4 Java sources to theproject/modules/web/target/scala-2.11/classes...
[info] *** Cumulative statistics at phase parser
[info] #created tree nodes           : 230115
[info] #created tree nodes by type   :
[info] #retained tree nodes          : 209100
[info] #retained tree nodes by type  : Ident: 61077, Select: 46661, Apply: 28827, Literal: 15756, ValDef: 12292, : 10016, TypeTree: 7182, TypeApply: 3557, AppliedTypeTree: 3472, Block: 2572, Function: 2514, DefDef: 2464, Import: 1925, CaseDef: 1644, Bind: 1466, If: 1137, This: 857, AssignOrNamedArg: 827, New: 766, Template: 716, : 664, Match: 625, ClassDef: 493, Typed: 329, Assign: 223, ModuleDef: 222, PackageDef: 201, Throw: 200, Annotated: 138, Try: 96, Alternative: 46, TypeDef: 39, SingletonTypeTree: 34, TypeBoundsTree: 27, PostfixSelect: 14, LabelDef: 9, Return: 7, Super: 3, CompoundTypeTree: 1, ExistentialTypeTree: 1
[info] *** Cumulative statistics at phase typer
[info] #symbols                      : 1219579
[info] #created tree nodes by type   :
[info] #unique types                 : 203810
[info] #retained tree nodes          : 511484
[info] #retained tree nodes by type  : Select: 161226, TypeTree: 65234, Ident: 57550, Apply: 46577, This: 38647, Literal: 24049, ValDef: 22046, TypeApply: 21801, : 16189, DefDef: 11589, ApplyToImplicitArgs: 11353, Block: 7201, CaseDef: 3735, Function: 3130, New: 2257, ApplyImplicitView: 2186, Import: 2091, Bind: 1711, Typed: 1701, Template: 1691, Super: 1643, Assign: 1471, If: 1448, ClassDef: 1229, Match: 1153, TypeDef: 804, UnApply: 490, ModuleDef: 462, Throw: 461, PackageDef: 201, Try: 96, Alternative: 46, LabelDef: 9, Return: 7, CompoundTypeTree: 0, SingletonTypeTree: 0, AppliedTypeTree: 0, : 0, TypeBoundsTree: 0, AssignOrNamedArg: 0, PostfixSelect: 0, ExistentialTypeTree: 0, Annotated: 0
[info] #created tree nodes           : 3560282
[info] #created tree nodes           : 9958
[info] *** Cumulative statistics at phase patmat
[info] #symbols                      : 1282870
[info] #created tree nodes by type   :
[info] #unique types                 : 133190
[info] #retained tree nodes          : 536523
[info] #retained tree nodes by type  : Select: 166746, TypeTree: 67614, Ident: 64591, Apply: 52370, This: 38663, Literal: 24953, ValDef: 24087, TypeApply: 22484, : 14010, DefDef: 11589, ApplyToImplicitArgs: 11353, Block: 9233, LabelDef: 3654, If: 3447, Function: 3130, New: 2549, ApplyImplicitView: 2186, Import: 2091, Template: 1691, Super: 1643, Typed: 1545, CaseDef: 1485, Assign: 1479, ClassDef: 1229, TypeDef: 804, Throw: 754, ModuleDef: 462, Match: 234, PackageDef: 201, Bind: 141, Try: 96, Return: 7, Alternative: 2, CompoundTypeTree: 0, SingletonTypeTree: 0, UnApply: 0, AppliedTypeTree: 0, : 0, TypeBoundsTree: 0, AssignOrNamedArg: 0, PostfixSelect: 0, ExistentialTypeTree: 0, Annotated: 0
[info] #created tree nodes           : 3680614
[info] #created tree nodes           : 9958
[info] *** Cumulative statistics at phase erasure
[info] #symbols                      : 1647187
[info] #created tree nodes by type   :
[info] #unique types                 : 179145
[info] #retained tree nodes          : 843787
[info] #retained tree nodes by type  : Select: 212509, Apply: 136845, TypeTree: 126495, This: 64270, Ident: 63984, ValDef: 40668, DefDef: 32844, : 32381, Literal: 29623, Block: 19695, TypeApply: 18923, New: 12307, ApplyToImplicitArgs: 11184, Typed: 6703, Template: 6676, ClassDef: 6668, Super: 6602, LabelDef: 3654, If: 3429, ArrayValue: 2347, ApplyImplicitView: 1521, Assign: 1504, CaseDef: 1486, Throw: 756, Match: 234, PackageDef: 201, Bind: 142, Try: 97, Import: 12, ApplyDynamic: 11, ModuleDef: 8, Return: 6, Alternative: 2, TypeDef: 0, CompoundTypeTree: 0, SingletonTypeTree: 0, Function: 0, UnApply: 0, AppliedTypeTree: 0, : 0, TypeBoundsTree: 0, AssignOrNamedArg: 0, PostfixSelect: 0, ExistentialTypeTree: 0, Annotated: 0
[info] #created tree nodes           : 4775835
[info] #created tree nodes           : 9958
[info] *** Cumulative statistics at phase cleanup
[info] #symbols                      : 1702654
[info] #created tree nodes by type   :
[info] #unique types                 : 191984
[info] #retained tree nodes          : 988384
[info] #retained tree nodes by type  : Select: 249333, Apply: 143331, TypeTree: 138558, Ident: 81513, This: 80147, ValDef: 51186, : 44311, Literal: 40480, DefDef: 36095, Block: 24386, TypeApply: 17146, New: 12414, Assign: 12138, ApplyToImplicitArgs: 11176, If: 6774, Typed: 6706, Template: 6676, ClassDef: 6668, Super: 6602, LabelDef: 3654, Throw: 2946, ArrayValue: 2380, ApplyImplicitView: 1521, CaseDef: 1497, Match: 234, PackageDef: 201, Bind: 153, Try: 108, Return: 28, Import: 12, ModuleDef: 8, Alternative: 2, TypeDef: 0, CompoundTypeTree: 0, SingletonTypeTree: 0, Function: 0, ApplyDynamic: 0, UnApply: 0, AppliedTypeTree: 0, : 0, TypeBoundsTree: 0, AssignOrNamedArg: 0, PostfixSelect: 0, ExistentialTypeTree: 0, Annotated: 0
[info] #created tree nodes           : 5150323
[info] #created tree nodes           : 9958
[info] *** Cumulative statistics at phase jvm
[info] #symbols                      : 6208008
[info] #created tree nodes by type   :
[info] #unique types                 : 211651
[info] #retained tree nodes          : 988384
[info] #retained tree nodes by type  : Select: 249333, Apply: 143331, TypeTree: 138558, Ident: 81513, This: 80147, ValDef: 51186, : 44311, Literal: 40480, DefDef: 36095, Block: 24386, TypeApply: 17146, New: 12414, Assign: 12138, ApplyToImplicitArgs: 11176, If: 6774, Typed: 6706, Template: 6676, ClassDef: 6668, Super: 6602, LabelDef: 3654, Throw: 2946, ArrayValue: 2380, ApplyImplicitView: 1521, CaseDef: 1497, Match: 234, PackageDef: 201, Bind: 153, Try: 108, Return: 28, Import: 12, ModuleDef: 8, Alternative: 2, TypeDef: 0, CompoundTypeTree: 0, SingletonTypeTree: 0, Function: 0, ApplyDynamic: 0, UnApply: 0, AppliedTypeTree: 0, : 0, TypeBoundsTree: 0, AssignOrNamedArg: 0, PostfixSelect: 0, ExistentialTypeTree: 0, Annotated: 0
[info] #created tree nodes           : 5150529
[info] #created tree nodes           : 9958
[warn] there were 45 inliner warnings; re-run with -Yinline-warnings for details
[warn] 8 warnings found
[success] Total time: 849 s, completed Oct 1, 2015 3:53:18 PM

正如你所看到的,有一个很大的时差:699秒!

0 个答案:

没有答案