gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 02:38:55 24 4
gpt4 key购买 nike

我有几个项目。我使用 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

所以想必我应该使用其他东西。但什么?

最佳答案

一切都始于 a workaround for #1156上面写着(在 #1156 中):

Basically, as of sbt 0.13.2 you can no longer republish a release if it already exists. This is quite a dangerous thing to do because it leads to broken caches all over. Only -SNAPSHOTs are allowed to be republished.

这意味着您publishLocal是一个稳定版本,而不是SNAPSHOT,并且首选选项是覆盖稳定版本。

作为解决方法,您可以使用 isSnapshot := true,如 @jsuereth's comment 中所确认的那样:

isSnapshot, currently, only denotes that the build can overwrite previous values.

我自己也用以下 build.sbt 确认了这一点:

version := "1.0.0"

查看 session :

➜  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 (应该会成功,但会出现警告 - 此用法已被弃用,并将在 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

一切如预期进行。警告就在那里。

让我们将 isSnapshot 设置为 true 以将稳定版本表示为正在更改

注意不过,我不建议这样做,因为构建中的其他一些代码可能依赖于正确的 isSnapshotfalse 对于 1.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

再次强调,没有警告 - 它按照广告宣传的那样工作。

关于sbt - 如何使用publishLocal覆盖本地稳定版本工件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26077419/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com