pantsbuild / jarjar

An export of https://code.google.com/p/jarjar/ @ svn:r142 for pants tool use and further development.
Apache License 2.0
37 stars 27 forks source link

Produce an all-deps artifact of jarjar #25

Closed ronshapiro closed 7 years ago

ronshapiro commented 7 years ago

Since there are lots of deps for jarjar, it makes it challenging to run from the command-line. Can you use the maven-shade-plugin to create a version of the build that bundles all the deps together? Google Java Format does this and it's relatively trivial. Happy to send a pull-request if you'd like.

ronshapiro commented 7 years ago

Hm, I didn't realize that pants was generating the POM, so this might be more complicated than I thought.

jsirois commented 7 years ago

Regardless, as our README states, we maintain this clone of the original jarjar google code project strictly for pants use. It is trivial fwiw to run jarjar using pants. This BUILD file:

jar_library(
  name='jarjar',
  jars=[
    jar('org.pantsbuild', 'jarjar', '1.6.3'),
  ]
)

jvm_binary(
  name='jarjar-main',
  dependencies=[
    ': jarjar',
  ],
  main='org.pantsbuild.jarjar.Main',
)

Can be run with: ./pants run //:jarjar-main -- [jarjar args]

jsirois commented 7 years ago

Using the BUILD file above you can also create a runnable fat jar with: ./pants binary //:jarjar-main. The all-inclusive jar will be plopped in dist and you can run with: java -jar dist/jarjar-main.jar .... We would never publish a fat jar though out of principle.