新版的 play framework 执行 play deps 时,会自动删除 lib 目录中,未在依赖文件中定义的 jar 包:
$ play deps
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.4.5, https://www.playframework.com
~
~ Resolving dependencies using F:\Myspace\anda\aderp-admin\conf\dependencies.yml
~
~
~ Installing resolved dependencies,
~
~ modules/secure -> D:\play\play-1.4.5\modules\secure
~ modules/crud -> D:\play\play-1.4.5\modules\crud
~
~ Synchronizing, deleting unknown dependencies
~
~ Deleted: F:\Myspace\anda\aderp-admin\lib\antlr-2.7.4.jar
~ Deleted: F:\Myspace\anda\aderp-admin\lib\bonecp-0.7.0.jar
~ Deleted: F:\Myspace\anda\aderp-admin\lib\chardet-1.0.jar
~ Deleted: F:\Myspace\anda\aderp-admin\lib\commons-beanutils-1.8.3.jar
~ Deleted: ...
要解决这个问题其实很简单,在 play deps 命令后面加一个 –nosync 参数就可以了:
play deps --nosync
~ _ _
~ _ __ | | __ _ _ _| |
~ | '_ \| |/ _' | || |_|
~ | __/|_|\____|\__ (_)
~ |_| |__/
~
~ play! 1.4.5, https://www.playframework.com
~
~ Resolving dependencies using F:\Myspace\anda\aderp-admin\conf\dependencies.yml
~
~
~ Installing resolved dependencies,
~
~ modules/secure -> D:\play\play-1.4.5\modules\secure
~ modules/crud -> D:\play\play-1.4.5\modules\crud
~
~ *****************************************************************************
~ WARNING: Your lib/ and modules/ directories are not synced with current dependencies (don't use --nosync to automatically delete them)
~
~ Unknown: F:\Myspace\anda\aderp-admin\lib\antlr-2.7.4.jar
~ Unknown: F:\Myspace\anda\aderp-admin\lib\axis.jar
~ Unknown: F:\Myspace\anda\aderp-admin\lib\bonecp-0.7.0.jar
~ Unknown: F:\Myspace\anda\aderp-admin\lib\chardet-1.0.jar
~ Unknown: F:\Myspace\anda\aderp-admin\lib\commons-beanutils-1.8.3.jar
~ Unknown: ...