如何在 SBT 中使用前缀文件夹压缩文件
要使用 Simple Build Tool 生成发行版 ZIP,只需执行
def distPath = (
((outputPath ##) / defaultJarName) +++
mainDependencies.scalaJars
)
lazy val dist = zipTask(distPath, "dist", "distribution.zip") dependsOn (`package`) describedAs("Zips up the project.")
此操作即可将 JAR 文件添加到 ZIP 的根目录中。如何将 JAR 添加到 ZIP 中的 lib
子文件夹中?
To generate a distribution ZIP with Simple Build Tool one can simply do
def distPath = (
((outputPath ##) / defaultJarName) +++
mainDependencies.scalaJars
)
lazy val dist = zipTask(distPath, "dist", "distribution.zip") dependsOn (`package`) describedAs("Zips up the project.")
This adds the JAR files into the root of the ZIP. How does one add the JARs into a lib
subfolder in the ZIP?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于 sbt 0.7.x:
据我所知,默认情况下没有实现任何功能。但是,您可以使用 SBT 的 FileUtilities。
尝试使用以下示例,它将您的工件 jar 复制到 tmp 目录中,压缩该目录,然后将其删除。将其扩展到依赖库应该很简单。
上面使用了
FileUtilities
中的以下函数:它们的声明应该是不言自明的。
For sbt 0.7.x:
Nothing implemented by default as far as I know. However, you can use SBT's FileUtilities.
Try playing around with the following example, which copies your artifact jar into a tmp dir, zips the dir, and deletes it. It should be straightforward to extend it to dependent libs.
The following functions from
FileUtilities
were used above:Their declarations should be self-explanatory.