buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject svn commit: r1528289 - in /buildr/trunk: CHANGELOG lib/buildr/java/commands.rb
Date Wed, 02 Oct 2013 00:39:47 GMT
Author: donaldp
Date: Wed Oct  2 00:39:46 2013
New Revision: 1528289

URL: http://svn.apache.org/r1528289
Log:
BUILDR-439 - Fix java command under windows when supplied with extremely long classpath.
          
 Submitted By Tammo van Lessen.

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/java/commands.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1528289&r1=1528288&r2=1528289&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Wed Oct  2 00:39:46 2013
@@ -1,4 +1,6 @@
 1.4.13 (2013-10-02)
+* Fixed:  BUILDR-439 - Fix java command under windows when supplied
+          with extremely long classpath. Submitted By Tammo van Lessen.
 * Fixed:  BUILDR-394 - Fix release task with standalone distribution.
           Submitted By Tammo van Lessen.
 * Added:  BUILDR-678 - Improve support for gpg signing artifacts

Modified: buildr/trunk/lib/buildr/java/commands.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/commands.rb?rev=1528289&r1=1528288&r2=1528289&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/commands.rb (original)
+++ buildr/trunk/lib/buildr/java/commands.rb Wed Oct  2 00:39:46 2013
@@ -63,7 +63,21 @@ module Java
         end
         cmd_args << path_to_bin('java')
         cp = classpath_from(options)
-        cmd_args << '-classpath' << cp.join(File::PATH_SEPARATOR) unless cp.empty?
+        paths = cp.map do |c|
+          path = File.directory?(c) && !c.end_with?('/') ? "#{c}/" : c.to_s
+          Buildr::Util.win_os? ? "/#{path}" : path
+        end
+        manifest = Buildr::Packaging::Java::Manifest.new([{'Class-Path' => paths.join("
")}])
+
+        tjar = Tempfile.new(['javacmd', '.jar'])
+        Zip::ZipOutputStream.open(tjar.path) do |zos|
+          zos.put_next_entry('META-INF/MANIFEST.MF')
+          zos.write manifest.to_s
+          zos.write "\n"
+        end
+        tjar.close
+
+        cmd_args << '-classpath' << tjar.path
         options[:properties].each { |k, v| cmd_args << "-D#{k}=#{v}" } if options[:properties]
         cmd_args += (options[:java_args] || (ENV['JAVA_OPTS'] || ENV['JAVA_OPTIONS']).to_s.split).flatten
         cmd_args += args.flatten.compact



Mime
View raw message