当前位置:  开发笔记 > 编程语言 > 正文

如何使用publishLocal覆盖本地稳定版本工件?

如何解决《如何使用publishLocal覆盖本地稳定版本工件?》经验,为你挑选了1个好方法。

我有几个项目.我publishLocal用来更新本地存储库.有时我正在并行处理其中的几个,我不想继续更新版本号.

所以我使用publishLocal它工作正常,但它会发出此警告

[warn]  This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /home/tim/.ivy2/local/com.optrak/vrpmodel_2.11/0.8.3/ivys/ivy.xml.sha1

所以我想应该使用别的东西.但是什么?



1> Jacek Laskow..:

这一切都始于#1156的解决方案(#1156中):

基本上,从sbt 0.13.2开始,如果已经存在,则无法再重新发布该版本.这是一件非常危险的事情,因为它会导致破坏缓存.只允许-SNAPSHOT重新发布.

这意味着您publishLocal不是稳定版本SNAPSHOT,首选选项是覆盖稳定版本.

作为一种解决方法,您可以使用@ jsuereth评论中的isSnapshot := true确认:

isSnapshot,目前仅表示构建可以覆盖以前的值.

我也自己确认了以下内容build.sbt:

version := "1.0.0"

见会议:

?  stable-version-published-twice  xsbt
JAVA_HOME=/Library/Java/JavaVirtualMachines/java8/Contents/Home
SBT_OPTS= -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -Dfile.encoding=UTF-8
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Updating {file:/Users/jacek/.sbt/0.13/plugins/}global-plugins...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to stable-version-published-twice (in build file:/Users/jacek/sandbox/stable-version-published-twice/)
> show version
[info] 1.0.0

您可能已经注意到该项目是1.0.0版本.这是第一个publishLocal.

> publishLocal
[info] Updating {file:/Users/jacek/sandbox/stable-version-published-twice/}stable-version-published-twice...
[info] Packaging /Users/jacek/sandbox/stable-version-published-twice/target/scala-2.10/stable-version-published-twice_2.10-1.0.0-sources.jar ...
[info] Done packaging.
[info] Wrote /Users/jacek/sandbox/stable-version-published-twice/target/scala-2.10/stable-version-published-twice_2.10-1.0.0.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] :: delivering :: default#stable-version-published-twice_2.10;1.0.0 :: 1.0.0 :: release :: Sun Sep 28 22:46:10 CEST 2014
[info]  delivering ivy file to /Users/jacek/sandbox/stable-version-published-twice/target/scala-2.10/ivy-1.0.0.xml
[info] Packaging /Users/jacek/sandbox/stable-version-published-twice/target/scala-2.10/stable-version-published-twice_2.10-1.0.0-javadoc.jar ...
[info] Done packaging.
[info] Packaging /Users/jacek/sandbox/stable-version-published-twice/target/scala-2.10/stable-version-published-twice_2.10-1.0.0.jar ...
[info] Done packaging.
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/poms/stable-version-published-twice_2.10.pom
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/jars/stable-version-published-twice_2.10.jar
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/srcs/stable-version-published-twice_2.10-sources.jar
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/docs/stable-version-published-twice_2.10-javadoc.jar
[info]  published ivy to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/ivys/ivy.xml
[success] Total time: 0 s, completed Sep 28, 2014 10:46:10 PM

它很好(正如预期的那样).这是另一个publishLocal(这应该成功警告 - This usage is deprecated and will be removed in sbt 1.0.- 因为我们正在重新发布稳定版本).

> publishLocal
[info] Wrote /Users/jacek/sandbox/stable-version-published-twice/target/scala-2.10/stable-version-published-twice_2.10-1.0.0.pom
[info] :: delivering :: default#stable-version-published-twice_2.10;1.0.0 :: 1.0.0 :: release :: Sun Sep 28 22:46:18 CEST 2014
[info]  delivering ivy file to /Users/jacek/sandbox/stable-version-published-twice/target/scala-2.10/ivy-1.0.0.xml
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/poms/stable-version-published-twice_2.10.pom
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/poms/stable-version-published-twice_2.10.pom.sha1
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/poms/stable-version-published-twice_2.10.pom.md5
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/poms/stable-version-published-twice_2.10.pom
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/jars/stable-version-published-twice_2.10.jar
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/jars/stable-version-published-twice_2.10.jar.sha1
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/jars/stable-version-published-twice_2.10.jar.md5
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/jars/stable-version-published-twice_2.10.jar
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/srcs/stable-version-published-twice_2.10-sources.jar
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/srcs/stable-version-published-twice_2.10-sources.jar.sha1
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/srcs/stable-version-published-twice_2.10-sources.jar.md5
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/srcs/stable-version-published-twice_2.10-sources.jar
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/docs/stable-version-published-twice_2.10-javadoc.jar
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/docs/stable-version-published-twice_2.10-javadoc.jar.sha1
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/docs/stable-version-published-twice_2.10-javadoc.jar.md5
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/docs/stable-version-published-twice_2.10-javadoc.jar
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/ivys/ivy.xml
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/ivys/ivy.xml.sha1
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[warn] Attempting to overwrite /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/ivys/ivy.xml.md5
[warn]  This usage is deprecated and will be removed in sbt 1.0.
[info]  published ivy to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/ivys/ivy.xml
[success] Total time: 0 s, completed Sep 28, 2014 10:46:18 PM

这与预期一致.警告在那里.

让我们设置isSnapshottrue将稳定版本表示为更改.

注:我不会推荐它,虽然,因为在构建一些其他的代码可以依靠正确的isSnapshotfalse1.0.0.

> set isSnapshot := true
[info] Defining *:isSnapshot
[info] The new value will be used by *:deliverLocalConfiguration, *:publishConfiguration and 1 others.
[info]  Run `last` for details.
[info] Reapplying settings...
[info] Set current project to stable-version-published-twice (in build file:/Users/jacek/sandbox/stable-version-published-twice/)

让我们publishLocal再次恢复稳定版本.

> publishLocal
[info] Wrote /Users/jacek/sandbox/stable-version-published-twice/target/scala-2.10/stable-version-published-twice_2.10-1.0.0.pom
[info] :: delivering :: default#stable-version-published-twice_2.10;1.0.0 :: 1.0.0 :: integration :: Sun Sep 28 22:46:44 CEST 2014
[info]  delivering ivy file to /Users/jacek/sandbox/stable-version-published-twice/target/scala-2.10/ivy-1.0.0.xml
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/poms/stable-version-published-twice_2.10.pom
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/jars/stable-version-published-twice_2.10.jar
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/srcs/stable-version-published-twice_2.10-sources.jar
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/docs/stable-version-published-twice_2.10-javadoc.jar
[info]  published ivy to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/ivys/ivy.xml
[success] Total time: 0 s, completed Sep 28, 2014 10:46:44 PM

它没有任何警告.我们再试publishLocal一次吧.

> publishLocal
[info] Wrote /Users/jacek/sandbox/stable-version-published-twice/target/scala-2.10/stable-version-published-twice_2.10-1.0.0.pom
[info] :: delivering :: default#stable-version-published-twice_2.10;1.0.0 :: 1.0.0 :: integration :: Sun Sep 28 22:46:46 CEST 2014
[info]  delivering ivy file to /Users/jacek/sandbox/stable-version-published-twice/target/scala-2.10/ivy-1.0.0.xml
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/poms/stable-version-published-twice_2.10.pom
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/jars/stable-version-published-twice_2.10.jar
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/srcs/stable-version-published-twice_2.10-sources.jar
[info]  published stable-version-published-twice_2.10 to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/docs/stable-version-published-twice_2.10-javadoc.jar
[info]  published ivy to /Users/jacek/.ivy2/local/default/stable-version-published-twice_2.10/1.0.0/ivys/ivy.xml
[success] Total time: 0 s, completed Sep 28, 2014 10:46:46 PM

同样,没有任何警告 - 它像广告中那样工作.


谢谢,需要在ThisBuild中设置isSnapshot:= true`用于多项目构建.
推荐阅读
ifx0448363
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有