Skip to content

@mguymon /gist:981589
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Buildr uberjar task using one-jar
# XXX: Set the deps you want
deps = []
deps << "com.thoughtworks.xstream:xstream:jar:1.3.1"
deps << "org.quartz-scheduler:quartz:jar:1.8.5"
task :uberjar => :package do |t|
assembly_dir = "target/assembly"
FileUtils.mkdir_p( "#{assembly_dir}/lib" )
FileUtils.mkdir_p( "#{assembly_dir}/main" )
FileUtils.copy "target/#{project.name}-#{project.version}.jar", "#{assembly_dir}/main"
artifacts = Buildr.artifacts(deps).map(&:to_s)
artifacts.each do |artifact|
FileUtils.copy artifact, "#{assembly_dir}/lib"
end
# XXX: path to one-jar-boot-0.97.jar - http://one-jar.sourceforge.net/
Unzip.new( assembly_dir => "/path/to/one-jar-boot-0.97.jar" ).extract
FileUtils.rm_rf "#{assembly_dir}/src"
File.open( "#{assembly_dir}/boot-manifest.mf", 'a') do |f|
# XXX: Set Java main class
f.write("One-Jar-Main-Class: com.example.Server\n")
end
`cd target/assembly; jar -cvfm ../#{project.name}-uberjar-#{project.version}.jar boot-manifest.mf .`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.