You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Maarten Billemont <lh...@gmail.com> on 2008/03/31 13:28:53 UTC

Default Packaging Type when converting from pom.xml

Buildr doesn't take default packaging type of jar into account when  
converting pom.xmls to buildfiles.  This causes it to die when it  
encounters a pom.xml file that does not declare a packaging type.  The  
following patch fixes this:

--- /usr/lib/ruby/gems/1.8/gems/buildr-1.2.10/lib/core/ 
generate.rb.old   2008-03-31 13:28:01 +0200
+++ /usr/lib/ruby/gems/1.8/gems/buildr-1.2.10/lib/core/ 
generate.rb       2008-03-31 13:28:07 +0200
@@ -157,6 +157,12 @@
          test_dependencies = test_dependencies.sort.map{|d|  
"'#{d}'"}.join(', ')
          script <<  "  test.with #{test_dependencies}" unless  
test_dependencies.empty?

+        if project['packaging'] == nil
+          packaging = 'jar'
+        else
+          packaging = project['packaging'].first
+        end
+
          if %w(jar war).include?(packaging)
            script <<  "  package :#{packaging}, :id => '#{artifactId}'"
          end


Re: Default Packaging Type when converting from pom.xml

Posted by Assaf Arkin <ar...@intalio.com>.
On Mon, Mar 31, 2008 at 4:28 AM, Maarten Billemont <lh...@gmail.com>
wrote:

> Buildr doesn't take default packaging type of jar into account when
> converting pom.xmls to buildfiles.  This causes it to die when it encounters
> a pom.xml file that does not declare a packaging type.  The following patch
> fixes this:


Thanks.  Fixed in SVN.

Assaf


>
>
> --- /usr/lib/ruby/gems/1.8/gems/buildr-1.2.10/lib/core/generate.rb.old
> 2008-03-31 13:28:01 +0200
> +++ /usr/lib/ruby/gems/1.8/gems/buildr-1.2.10/lib/core/generate.rb
> 2008-03-31 13:28:07 +0200
> @@ -157,6 +157,12 @@
>         test_dependencies = test_dependencies.sort.map{|d|
> "'#{d}'"}.join(', ')
>         script <<  "  test.with #{test_dependencies}" unless
> test_dependencies.empty?
>
> +        if project['packaging'] == nil
> +          packaging = 'jar'
> +        else
> +          packaging = project['packaging'].first
> +        end
> +
>         if %w(jar war).include?(packaging)
>           script <<  "  package :#{packaging}, :id => '#{artifactId}'"
>         end
>
>