hmvictor / radar-netbeans

A SonarQube plugin for Netbeans
Other
33 stars 22 forks source link

Error encountered with multi-module project - "You must define the following mandatory properties" (sonar.sources) #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
(I am not sure if this is a problem with the plugin, or Maven.)

What steps will reproduce the problem?
1. NetBeans 8.0.1
2. File > New Project
3. Maven > Enterprise Application, this will set up a multi-module project and 
includes EAR, EJB, and Web modules.
4. Add a dummy Java source file in EJB module.
5. Add a dummy Java source file in Web module.
6. Compile the project. Ensure the EJB and Web module classes are generated.
7. Right click the main project and use "Get issues with Sonar Runner"
8. Output shows

Starting sonar-runner
INFO: SonarQube Server 4.4
13:11:30.408 INFO  - Incremental mode
13:11:30.410 INFO  - Load global settings
13:11:30.768 INFO  - User cache: C:\Users\cchan\.sonar\cache
13:11:30.776 INFO  - Install plugins
13:11:31.101 INFO  - Include plugins: 
13:11:31.102 INFO  - Exclude plugins: devcockpit, jira, pdfreport, views, 
report, buildstability, scmactivity, buildbreaker
13:11:41.248 INFO  - Create JDBC datasource for 
jdbc:h2:C:\Users\cchan\Desktop\temp\multi-module-project\mavenproject2\.\.sonar\
.sonartmp\preview1413317491461-0
13:11:42.450 INFO  - Initializing Hibernate
Exception in thread "main" org.sonar.runner.impl.RunnerException: Unable to 
execute Sonar
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
    at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
    at org.sonar.runner.impl.BatchLauncherMain.execute(BatchLauncherMain.java:41)
    at org.sonar.runner.impl.BatchLauncherMain.main(BatchLauncherMain.java:59)
Caused by: java.lang.IllegalStateException: You must define the following 
mandatory properties for 'com.mycompany:mavenproject2-ear': sonar.sources
    at org.sonar.batch.scan.ProjectReactorBuilder.checkMandatoryProperties(ProjectReactorBuilder.java:289)
    at org.sonar.batch.scan.ProjectReactorBuilder.defineProject(ProjectReactorBuilder.java:125)
    at org.sonar.batch.scan.DeprecatedProjectReactorBuilder.loadChildProject(DeprecatedProjectReactorBuilder.java:74)
    at org.sonar.batch.scan.ProjectReactorBuilder.defineChildren(ProjectReactorBuilder.java:192)
    at org.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:116)
    at org.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:114)
    at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
    at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
    at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:110)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:185)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
    at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
    ... 6 more
Error executing sonar-runner

What is the expected output? What do you see instead?
Since a EAR file is mainly used for packaging, there is typically no source 
code. Therefore, specifying sonar.sources doesn't make sense.
I would expect Sonar runner to scan modules with source code defined and skip 
over others: EJB and WEB modules. 

What version of the product are you using? On what operating system?
* NetBeans 8.0.1
* SonarQube 4.4

Please provide any additional information below.
If I run the analysis manually against the EJB module and WEB module, the 
plugin completes successfully.

Original issue reported on code.google.com by charles....@gmail.com on 14 Oct 2014 at 8:20

Attachments:

GoogleCodeExporter commented 9 years ago
Problem identified. Thank you for the clear explanation of the test case.

Original comment by hmvic...@gmail.com on 15 Oct 2014 at 4:14

GoogleCodeExporter commented 9 years ago
Check if the module/subproject has source groups. If not, module is ignored.

Original comment by hmvic...@gmail.com on 15 Oct 2014 at 4:43