[
https://issues.apache.org/jira/browse/BUILDR-708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14642110#comment-14642110
]
Alex Boisvert edited comment on BUILDR-708 at 7/26/15 10:00 PM:
----------------------------------------------------------------
Ok, looked into this ... not sure exactly what you're running into but I
recommend changing lines 117..119 in Buildr's ant_project.rb from:
{code}
rescue
@logger.error("Error instantiating '#{sym.to_s}' task: " + $!.to_s)
raise
{code}
to this:
{code}
rescue => e # CHANGED THIS LINE
@logger.error("Error instantiating '#{sym.to_s}' task: " + $!.to_s)
e.printStackTrace() # ADDED THIS LINE
raise
{code}
With this change, I was able to get a full stack trace of the exception, which
was a nested a ClassNotFoundEception for 'com.mysql.jdbc.Driver'.
Note: This exception came from the Sonar *server*. The class needs to be
added to the server's classloader. The stack trace makes it look like the Ant
task needs the driver itself (which is not the case, as far as I could tell).
Let me know if this helps.
was (Author: boisvert):
Ok, looked into this ... not sure exactly what you're running into but I
recommend changing lines 117..119 in Buildr's ant_project.rb from:
{code}
rescue
@logger.error("Error instantiating '#{sym.to_s}' task: " + $!.to_s)
raise
{code}
to this:
{code}
rescue => e # CHANGED THIS LINE
@logger.error("Error instantiating '#{sym.to_s}' task: " + $!.to_s)
e.printStackTrace() # ADDED THIS LINE
raise
{code}
With this change, I was able to get a full stack trace of the exception, which
nested a ClassNotFoundEception for 'com.mysql.jdbc.Driver'.
Note: This exception came from the Sonar *server*. The class needs to be
added to the server's classloader. The stack trace makes it look like the Ant
task needs the driver itself (which is not the case, as far as I could tell).
Let me know if this helps.
> Sonar task fails
> ----------------
>
> Key: BUILDR-708
> URL: https://issues.apache.org/jira/browse/BUILDR-708
> Project: Buildr
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 1.4.23
> Environment: Ubuntu Server 11.04
> Reporter: Taylor K
> Attachments: killer-app.zip
>
>
> Trying to run SonarQube analysis through buildr, but it fails. I have
> successfully done this using Sonar-Runner standalone, but not through buildr.
> My trace log is below.
> (in /home/jsmith/temp/workspace, development)
> ** Invoke foo (first_time)
> ** Execute foo
> ** Invoke foo:configEclipseSettings (first_time)
> ** Execute foo:configEclipseSettings
> ** Invoke foo:module1 (first_time)
> ** Execute foo:module1
> ** Invoke foo:module2 (first_time)
> ** Execute foo:module2
> ** Invoke foo:module1
> ** Invoke foo:module1
> ** Invoke foo:module3 (first_time)
> ** Execute foo:module3
> ** Invoke foo:module1
> ** Invoke foo:module1
> ** Invoke foo:module2
> ** Invoke foo:module2
> ** Invoke foo:module4 (first_time)
> ** Execute foo:module4
> ** Invoke foo:module1
> ** Invoke foo:module1
> ** Invoke foo:configEclipseSettings
> ** Invoke foo:module1
> ** Invoke foo:module2
> ** Invoke foo:module3
> ** Invoke foo:module4
> ** Invoke foo:configEclipseSettings
> ** Invoke foo:module1
> ** Invoke foo:module2
> ** Invoke foo:module3
> ** Invoke foo:module4
> ** Invoke foo
> ** Invoke foo:configEclipseSettings
> ** Invoke foo:module1
> ** Invoke foo:module2
> ** Invoke foo:module3
> ** Invoke foo:module4
> ** Invoke foo:sonar (first_time)
> ** Execute foo:sonar
> Sonar: Analyzing source code...
> ** Invoke
> /home/jsmith/temp/workspace/lib/repository/org/codehaus/sonar-plugins/sonar-ant-task/2.2/sonar-ant-task-2.2.jar
> (first_time, not_needed)
> ** Invoke
> /home/jsmith/temp/workspace/lib/repository/org/apache/ant/ant/1.8.3/ant-1.8.3.jar
> (first_time, not_needed)
> ** Invoke
> /home/jsmith/temp/workspace/lib/repository/org/apache/ant/ant-launcher/1.8.3/ant-launcher-1.8.3.jar
> (first_time, not_needed)
> ** Invoke /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/java (first_time,
> not_needed)
> ** Invoke /usr/lib/jvm/java-7-oracle/lib/tools.jar (first_time, not_needed)
> [sonar] Apache Ant(TM) version 1.8.3 compiled on February 26 2012
> [sonar] SonarQube Ant Task version: 2.2
> [sonar] Loaded from:
> file:/home/jsmith/temp/workspace/lib/repository/org/codehaus/sonar-plugins/sonar-ant-task/2.2/sonar-ant-task-2.2.jar
> INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is
> platform dependent)
> INFO: Work directory: /home/jsmith/temp/workspace/.sonar
> INFO: SonarQube Server 5.1
> 14:01:06.591 INFO - Load global repositories
> 14:01:06.723 INFO - Load global repositories (done) | time=134ms
> 14:01:06.725 INFO - Server id: 20150707135623
> 14:01:06.727 INFO - User cache: /home/jsmith/.sonar/cache
> 14:01:06.734 INFO - Install plugins
> 14:01:06.813 INFO - Install JDBC driver
> 14:01:06.820 INFO - Create JDBC datasource for
> jdbc:mysql://127.0.0.1:3306/sonar?useUnicode=true&characterEncoding=utf8
> E, [2015-07-22T14:01:06.976499 #2969] ERROR -- : Error instantiating 'sonar'
> task: Unable to execute Sonar
> Buildr aborted!
> RuntimeError : org.sonar.runner.impl.RunnerException: Unable to execute Sonar
> /var/lib/gems/1.9.1/gems/atoulme-Antwrap-0.7.5/lib/ant_project.rb:119:in
> `rescue in method_missing'
> /var/lib/gems/1.9.1/gems/atoulme-Antwrap-0.7.5/lib/ant_project.rb:122:in
> `method_missing'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/addon/buildr/sonar.rb:55:in `block in
> sonar'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/java/ant.rb:74:in `block in
> ant'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/java/ant.rb:70:in `tap'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/java/ant.rb:70:in `ant'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/addon/buildr/sonar.rb:35:in `sonar'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/addon/buildr/sonar.rb:118:in `block (2
> levels) in <module:ProjectExtension>'
> /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
> /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in
> execute'
> /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
> /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/core/application.rb:662:in
> `block in invoke_with_call_chain'
> /usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/core/application.rb:648:in
> `invoke_with_call_chain'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/core/application.rb:643:in
> `invoke'
> /var/lib/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in
> `invoke_task'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/core/application.rb:238:in
> `block (2 levels) in top_level'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/core/application.rb:238:in
> `each'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/core/application.rb:238:in
> `block in top_level'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/core/application.rb:535:in
> `standard_exception_handling'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/core/application.rb:230:in
> `top_level'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/core/application.rb:131:in
> `block in run'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/core/application.rb:535:in
> `standard_exception_handling'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/lib/buildr/core/application.rb:128:in
> `run'
> /var/lib/gems/1.9.1/gems/buildr-1.4.23/bin/buildr:20:in `<top (required)>'
> /usr/local/bin/buildr:23:in `load'
> /usr/local/bin/buildr:23:in `<main>'
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)