Adds the ability to specify explicit fields in MANIFEST.MF in a jvm_binary target.

Review Request #2084 - Created April 16, 2015 and submitted

Eric Ayers
dturner-tw, nhoward_tw, stuhood
  • Added 'manifest_entries' to jvm_binary target
  • Added a query to see if the manifest is empty in Manifest
  • Support detecting the git workdir from a directory other than cwd
  • Allow setting of both a main entry point and a custom manifest file when invoking jar-tool
  • Special 'git' value for Implementation-Version pulls the current git commit id for the directory where the jvm_binary() target is defined.

Updated tests.
Modified the hello/simple/BUILD file

 jvm_binary(name = 'simple',
   source = '',
-  main = 'org.pantsbuild.example.hello.simple.HelloWorld',
+  #main = 'org.pantsbuild.example.hello.simple.HelloWorld',
+  manifest_entries = {
+    'Main-Class' : 'org.pantsbuild.example.hello.simple.HelloWorld',
+    'Foo' : 'foo',
+    'Implementation-Version' : 'git',
+  }

Then ran ./pants binary examples/src/java/org/pantsbuild/example/hello/simple/ and inspected the MANIFEST.MF file:

Manifest-Version: 1.0
Implementation-Version: 748d4daed04332a43ef0e421fd1dacc28186afb1
Foo: foo
Created-By: com.twitter.common.jar.tool.JarBuilder
Main-Class: org.pantsbuild.example.hello.simple.HelloWorld


  • 0
  • 1
  • 1
  • 2
Description From Last Updated
Eric Ayers
David Turner
Stu Hood
Eric Ayers
David Turner
Eric Ayers
Eric Ayers
Eric Ayers
Eric Ayers
Eric Ayers
Review request changed

Status: Closed (submitted)

Change Summary:

Thanks for the feedback David & Stu. Commit 40a4a5b

Stu Hood

src/python/pants/backend/jvm/tasks/ (Diff revision 5)

These workunits will be nested now, but I don't think that was intended?

  1. Sorry, missed this comment before.
    You are right, this was not intended. I think its harmless, the jar_builder context will just be held longer, but I'll submit a small RB to put it back to the way it was because its not needed.

  2. See