A packaging method that has no effect in Buildr

I am trying to pack a scala project in a jar and write properties to the manifest using the Buildrs package () method.

The package does not seem to affect the manifest. Here's the build file:

VERSION_NUMBER = "1.0.0" GROUP = "Green" COPYRIGHT = "Green CopyRight" require 'buildr/scala' Buildr::Scala::Scalac::REQUIRES.library = '2.8.0-SNAPSHOT' Buildr::Scala::Scalac::REQUIRES.compiler = '2.8.0-SNAPSHOT' Java.classpath.reject! { |c| c.to_s.index('scala') } Java.classpath << Buildr::Scala::Scalac::REQUIRES ENV['USE_FSC'] = 'yes' repositories.remote << "http://www.ibiblio.org/maven2/" desc "The Green project" define "Green" do project.version = VERSION_NUMBER project.group = GROUP package(:jar).with :manifest=>manifest.merge( 'Main-Class'=>'com.acme.Main', 'Implementation-Vendor'=>COPYRIGHT ) end 

And here is the resulting manifest:

 Build-By: brianheylin Build-Jdk: 1.6.0_17 Implementation-Title: The Green project Implementation-Version: Implementation-Vendor: Main-Class: green.GreenMain Manifest-Version: 1.0 Created-By: Buildr 

Note that neither the provider-implementation property nor the Main-Class property has been overwritten. I run Buildr as follows:

 jruby -S buildr clean package 

I am using jRuby 1.4.0 and Buildr 1.3.5 (installed as a gem). Does anyone know why this is so?

+4
source share
4 answers

I can not reproduce this problem after the first appearance.

0
source

I checked this quickly using buildr 1.3.5 + Ruby 1.8.6 and got the correct manifest. I made a few small changes to the assembly file that do not seem to matter in relation to your manifest. Here is my test build file:

 ENV['JAVA_HOME'] = 'C:\Java\32\jdk1.6.0_17' VERSION_NUMBER = "1.0.0" GROUP = "Green" COPYRIGHT = "Green CopyRight" require 'buildr/scala' desc "The Green project" define "Green" do project.version = VERSION_NUMBER project.group = GROUP package(:jar).with :manifest=>manifest.merge( 'Main-Class'=>'com.acme.Main', 'Implementation-Vendor'=>COPYRIGHT ) end 

And here is the result:

 Implementation-Vendor: Green CopyRight Manifest-Version: 1.0 Build-By: Travis Created-By: Buildr Build-Jdk: 1.6.0_17 Implementation-Title: The Green project Implementation-Version: Main-Class: com.acme.Main 

Sorry, I can’t tell you why this works for me, but maybe my post will cause some ideas.

+1
source

Try testing your buildfile under MRI 1.8.6, not JRuby. Perhaps there is an error that appears only in this runtime (unlikely). It is also possible that there is some oddity arising from the use of Scala 2.8. Try a simple application with the same buildfile under Scala 2.7 and see if that helps.

I'm sorry that I can’t give you more than wild guesses. Your buildfile looks like it should work, so something strange is happening.

0
source

I tested with both C-Ruby 1.8.7 and JRuby 1.4.0, and I cannot reproduce the problem using the buildfile your provided (with buildr 1.3.5 in both cases)

0
source

All Articles