Return-Path: Delivered-To: apmail-incubator-buildr-commits-archive@locus.apache.org Received: (qmail 18840 invoked from network); 29 Jul 2008 00:41:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Jul 2008 00:41:22 -0000 Received: (qmail 42424 invoked by uid 500); 29 Jul 2008 00:41:22 -0000 Delivered-To: apmail-incubator-buildr-commits-archive@incubator.apache.org Received: (qmail 42402 invoked by uid 500); 29 Jul 2008 00:41:22 -0000 Mailing-List: contact buildr-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: buildr-dev@incubator.apache.org Delivered-To: mailing list buildr-commits@incubator.apache.org Received: (qmail 42391 invoked by uid 99); 29 Jul 2008 00:41:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 28 Jul 2008 17:41:22 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Jul 2008 00:40:36 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4DA97234C173 for ; Mon, 28 Jul 2008 17:40:32 -0700 (PDT) Message-ID: <947222971.1217292032304.JavaMail.jira@brutus> Date: Mon, 28 Jul 2008 17:40:32 -0700 (PDT) From: "Assaf Arkin (JIRA)" To: buildr-commits@incubator.apache.org Subject: [jira] Resolved: (BUILDR-110) error creating buildfile from pom In-Reply-To: <470552999.1217288551599.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/BUILDR-110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Assaf Arkin resolved BUILDR-110. -------------------------------- Resolution: Fixed Fix Version/s: 1.3.3 > error creating buildfile from pom > --------------------------------- > > Key: BUILDR-110 > URL: https://issues.apache.org/jira/browse/BUILDR-110 > Project: Buildr > Issue Type: Bug > Components: Core features > Affects Versions: 1.3.1, 1.3.2 > Reporter: Geoffrey Ruscoe > Fix For: 1.3.3 > > > When using option to create buildfile from maven2 pom I got the following error (after I turned on trace) > rake aborted! > undefined method `find' for nil:NilClass > /usr/local/jruby-1.1.3/lib/ruby/gems/1.8/gems/buildr-1.3.2-java/lib/buildr/core/generate.rb:153:in `from_maven2_pom' > After looking into the issue I found that the code in question was the following: > plugins = project['build'].first['plugins'].first['plugin'] rescue {} > compile_plugin = plugins.find{|pl| (pl['groupId'].nil? or pl['groupId'].first == 'org.apache.maven.plugins') and pl['artifactId'].first == 'maven-compiler-plugin'} > if compile_plugin > source = compile_plugin.first['configuration'].first['source'] rescue nil > target = compile_plugin.first['configuration'].first['target'] rescue nil > script << " compile.options.source = '#{source}'" if source > script << " compile.options.target = '#{target}'" if target > end > my projects use a parent pom which specifies some of the plugins, so I think that some of them may not have any. All I did for a fix was to wrap with the test for nil. While this worked for me (at least to create my buildfile). I am just starting to learn the source, so this patch will need a more expert opinion. > plugins = project['build'].first['plugins'].first['plugin'] rescue {} > if plugins != nil > compile_plugin = plugins.find{|pl| (pl['groupId'].nil? or pl['groupId'].first == 'org.apache.maven.plugins') and pl['artifactId'].first == 'maven-compiler-plugin'} > if compile_plugin > source = compile_plugin.first['configuration'].first['source'] rescue nil > target = compile_plugin.first['configuration'].first['target'] rescue nil > script << " compile.options.source = '#{source}'" if source > script << " compile.options.target = '#{target}'" if target > end > end -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.