Re: trivial third party jar dependancy



On Fri, 28 Mar 2008 03:26:52 +0000, Mark Space wrote:


Yes! Good job. I just showed you the first part -- with a .class file,
the -classpath on the java command [1] points to the jar files, or other
classes or .zip files, that the .class uses.

Ok, thanks, got it :)

Now, is it "crazy" or does it make sense to (sometimes) perform a
colossal build which would build all the different jar files in one go?
Of course, theoretically, you don't need to do that, except:


In theory there is no difference between theory and practice. In practice
there is.
Yogi Berra


Just for reference, the (ruby) rake build file:


thufir@arrakis:~/jrake$
thufir@arrakis:~/jrake$ cat rakefile.rb
namespace :java do

J_ROOT = "/home/thufir/jrake/"

task :test => :package do
puts "test"
FileUtils.cd("#{J_ROOT}")
FileUtils.cd("package")
system("java -jar Foo.jar")
end

task :package => :jar do
puts "package"
end

task :jar => :compile do
puts "jar"
FileUtils.cd("#{J_ROOT}")
FileUtils.cd("prod")

system("jar cfm #{J_ROOT}package/Foo.jar manifest.txt
thufir/foo/*.class")
FileUtils.rm("manifest.txt")
end

task :create_manifest => :create_directories do
puts "create_manifest"
FileUtils.cd("#{J_ROOT}")
FileUtils.cd("prod")

File.open('manifest.txt', 'w') do |manifest|
manifest.puts "Main-Class: thufir.foo.Foo\n"
manifest.puts "Class-Path: #{J_ROOT}lib/thufir/
math/Calculations.jar\n"
end
end

task :compile => :create_manifest do
puts "compile"
FileUtils.cd("#{J_ROOT}")
FileUtils.cd("src")
system("javac -d /home/thufir/jrake/prod/ -cp \"/home/
thufir/jrake/lib/thufir/math/Calculations.jar\" thufir/foo/Foo.java")
end

task :create_directories => :clobber do
puts "create_directories"
FileUtils.cd("#{J_ROOT}")
FileUtils.mkdir("prod")
FileUtils.mkdir("package")
end

task :clobber do
puts "clobber"
FileUtils.cd("#{J_ROOT}")
FileUtils.rm_rf("prod")
FileUtils.rm_rf("package")
end

end
thufir@arrakis:~/jrake$



-Thufir

.