Advertisement
dginz

Gradle: packaging fat jar with tests

Apr 9th, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.37 KB | None | 0 0
  1. task testsJar(type: Jar) {
  2.     from sourceSets.test.output
  3. }
  4.  
  5. task fatJarWithTests(type: Jar) {
  6.     manifest {
  7.         attributes 'Main-Class' : 'com.example.Main'
  8.     }
  9.     baseName = project.name + '-all'
  10.     from {
  11.         configurations.compile
  12.                 .collect {
  13.             it.isDirectory() ? it : zipTree(it)
  14.         }
  15.     }
  16.     with jar, testsJar
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement