[
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.