Are you talking about using Simon Tuffs' One-JAR 
(http://one-jar.sourceforge.net/)?  I use this to package a "fat" executable 
jar in a Gradle script for one of my projects.

I think you have 2 options for using One-JAR within Gradle:

1.  Try out one of the few Gradle plugins that some smart people have written 
e.g. Robert Fischer's OneJar plugin 
http://wiki.gradle.org/display/GRADLE/Plugins#Plugins-OneJarplugin

2.  Use One-JAR's Ant task within your Gradle script.

I currently use #2 b/c it was really easy and allowed me to customize my build 
the way I wanted.  I use something like this:

apply plugin: "java"

jar {
        manifest {
                attributes 'Main-Class': 'your.executable.MainClass'
        }
}

task oneJar {
        dependsOn jar
        doFirst {
                ant.taskdef(name: "onejar", classname: 
"com.simontuffs.onejar.ant.OneJarTask", classpath: 
file("one-jar-ant-task-0.96.jar"), onerror: "report")
                ant.onejar(destfile: 
jar.destinationDir.path+"/"+project.archivesBaseName+"-cli-"+version+".jar") {
                        ant.main(jar: project.tasks.jar.archivePath)
                        ant.lib() {
                                configurations.runtime.findAll { 
!configurations.provided.contains(it) }.each { f ->
                                        ant.fileset(file: f.path)
                                }
                        }
                }
        }
}

Where "provided" is a custom configuration used simply to make sure certain 
things are excluded from the "fat" jar.

Good luck!



Andrew Goode | Technical Architect/Team Lead
tel: 678-762-6861
andrew.go...@nextraq.com
1200 Lake Hearn Drive, Suite 500, Atlanta, GA, 30319
http://www.nextraq.com

This communication, along with any attachment(s), is intended only for the use 
of the addressee(s) and may contain proprietary, confidential or privileged 
information. If you are not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of any information contained in 
or attached to this communication is strictly prohibited. If you have received 
this message in error, please notify the sender immediately and destroy the 
original communication and its attachments without reading, printing or saving 
in any manner. Thank you.

-----Original Message-----
From: Roger Studner [mailto:rstud...@gmail.com]
Sent: Friday, January 20, 2012 10:26 AM
To: user@gradle.codehaus.org
Subject: [gradle-user] combo of things i'm trying to accomplish

I'm trying to wean someone off maven (yay!).. but they have one plugin I can't 
seem to beat :)

I want to be able to make, essentially, a "fat jar" that also has a MANIFEST.MF 
that is executable.

so fat jar problem (get all the classes etc etc into 1 jar).. combined with 
executable jar.

Thoughts?

Thanks!

Roger


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to