Saurabh Agarwal | 8 Nov 08:00 2012
Picon

Sonar not able to scan directories recursively - Sonar 3.3 , Sonar runner - 2.0

Hi ,

We are having a code hierarchy something like this

module1/src
/src/examples
/src/main
/src/test
/src/web

In sonar properties file I give the properties like

sonar.projectBaseDir=/module1/src/
sonar.sources=/module1/src/

But since code lies only in two dir main and web it gives error that
cannot Analyze the file

Can anybody help me with the same.

Exception in thread "main" org.sonar.runner.RunnerException:
org.sonar.squid.api.AnalysisException: Sonar is unable to analyze file
: '/module1/src/main/AlarmConfiguration.java'
        at org.sonar.runner.Runner.delegateExecution(Runner.java:288)
        at org.sonar.runner.Runner.execute(Runner.java:151)
        at org.sonar.runner.Main.execute(Main.java:84)
        at org.sonar.runner.Main.main(Main.java:56)
Caused by: org.sonar.squid.api.AnalysisException: Sonar is unable to
analyze file : '/module1/src/main/AlarmConfiguration.java'
        at org.sonar.java.ast.AstScanner.scan(AstScanner.java:126)
(Continue reading)

Freddy Mallet | 9 Nov 15:48 2012
Picon

Re: Sonar not able to scan directories recursively - Sonar 3.3 , Sonar runner - 2.0

Hello,


This error occurs because the root directory of the java package is not module1/src/ but module1/src/main

So if you replace 
sonar.sources=/module1/src/
by
sonar.sources=/module1/src/main

this should fix your issue

Kind regards

-----
Sonar for Continuous Inspection



On Thu, Nov 8, 2012 at 8:00 AM, Saurabh Agarwal <sagarwal1981-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi ,

We are having a code hierarchy something like this

module1/src
/src/examples
/src/main
/src/test
/src/web

In sonar properties file I give the properties like

sonar.projectBaseDir=/module1/src/
sonar.sources=/module1/src/

But since code lies only in two dir main and web it gives error that
cannot Analyze the file

Can anybody help me with the same.


Exception in thread "main" org.sonar.runner.RunnerException:
org.sonar.squid.api.AnalysisException: Sonar is unable to analyze file
: '/module1/src/main/AlarmConfiguration.java'
        at org.sonar.runner.Runner.delegateExecution(Runner.java:288)
        at org.sonar.runner.Runner.execute(Runner.java:151)
        at org.sonar.runner.Main.execute(Main.java:84)
        at org.sonar.runner.Main.main(Main.java:56)
Caused by: org.sonar.squid.api.AnalysisException: Sonar is unable to
analyze file : '/module1/src/main/AlarmConfiguration.java'
        at org.sonar.java.ast.AstScanner.scan(AstScanner.java:126)
        at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:98)
        at org.sonar.java.JavaSquid.scan(JavaSquid.java:92)
        at org.sonar.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:74)
        at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
        at org.sonar.batch.phases.Phases.execute(Phases.java:97)
        at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:128)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:114)
        at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:109)
        at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:104)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:121)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.Batch.execute(Batch.java:104)
        at org.sonar.runner.internal.batch.Launcher.executeBatch(Launcher.java:69)
        at org.sonar.runner.internal.batch.Launcher.execute(Launcher.java:61)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.sonar.runner.Runner.delegateExecution(Runner.java:285)
        ... 3 more
Caused by: org.sonar.squid.api.AnalysisException: The source directory
does not correspond to the package declaration
com.cisco.unity.serviceability.alarms
        at org.sonar.java.ast.visitors.PackageVisitor.checkPhysicalDirectory(PackageVisitor.java:99)
        at org.sonar.java.ast.visitors.PackageVisitor.getPackageKey(PackageVisitor.java:69)
        at org.sonar.java.ast.visitors.PackageVisitor.visitFile(PackageVisitor.java:38)
        at com.sonar.sslr.impl.ast.AstWalker.walkVisitAndListen(AstWalker.java:63)
        at com.sonar.sslr.impl.ast.AstWalker.walkAndVisit(AstWalker.java:58)
        at org.sonar.java.ast.AstScanner.scan(AstScanner.java:87)
        ... 24 more
bash-3.2$ vim ../conf/sonar-runner.properties

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Gmane