How to add custom lines to MANIFEST.MF?

你。 提交于 2019-12-05 09:49:49

I think you may want something like this (note the manifestSettings added to the settings of the project).

import sbt._
import Keys._
import java.util.Date
import sbt.Package.ManifestAttributes

object MyBuild extends Build {

  lazy val manifestSettings = Seq(
    packageOptions in (Compile, packageBin) += 
         Package.ManifestAttributes( "Build" -> "true" )
  )

  lazy val root = Project(id = "root", base = file(".")).settings(manifestSettings: _*)

}

Then you should be able to call package and have the a jar with the extra manifest entry.

Edit

To get the ("Buid" -> <current time>) the manifestSettings should be

lazy val manifestSettings = Seq(
  packageOptions in (Compile, packageBin) += 
           Package.ManifestAttributes( "Build" -> new Date().toString() )
)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!