使用Sonar插件和Jenkins时遇到问题!
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar (default-cli) on project wso2mdm-parent: Can not execute SonarQube analysis
这是日志:
[ERROR] Sonar is unable to analyze file : '/var/lib/jenkins/workspace/project EMM-WSO2-V2_-_Audit qualité/modules/components/mdm-mgt/org.wso2.mdm.mdmmgt/src/main/java/org/wso2/mdm/mdmmgt/util/MDMAndroidOperationUtil.java'
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] WSO2 MDM - Parent .................................. FAILURE [ 57.609 s]
[INFO] mdm-mgt ............................................ SKIPPED
[INFO] org.wso2.mdm.mdmmgt ................................ SKIPPED
[INFO] app-mgt ............................................ SKIPPED
[INFO] WSO2 Carbon - Mobile Device app Management Core .... SKIPPED
[INFO] WSO2 MDM - Mobile Device Management Admin Services . SKIPPED
[INFO] wso2mdm-product-mobileservices ..................... SKIPPED
[INFO] JAX-RS Windows API ................................. SKIPPED
[INFO] JAX-RS Android API ................................. SKIPPED
[INFO] WSO2 EMM - Enterprise Mobility Manager End-user Web Application SKIPPED
[INFO] WSO2 EMM - Enterprise Mobility Manager Web Agent ... SKIPPED
[INFO] WSO2 Mobile Device Manager (MDM) - UI styles ....... SKIPPED
[INFO] WSO2 Mobile Device Manager (MDM) Features .......... SKIPPED
[INFO] WSO2 Mobile Device Manager (MDM) Styles Feature .... SKIPPED
[INFO] org.wso2.mdm.mdmmgt.server.feature ................. SKIPPED
[INFO] WSO2 Mobile Device Manager (MDM) - P2 Profile Gen .. SKIPPED
[INFO] WSO2 Mobile Device Manager (MDM) - Distribution .... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:11 min
[INFO] Finished at: 2016-02-02T15:49:51+01:00
[INFO] Final Memory: 61M/404M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar (default-cli) on project wso2mdm-parent: Can not execute SonarQube analysis: Sonar is unable to analyze file : '/var/lib/jenkins/workspace/project EMM-WSO2-V2_-_Audit qualité/modules/components/mdm-mgt/org.wso2.mdm.mdmmgt/src/main/java/org/wso2/mdm/mdmmgt/util/MDMAndroidOperationUtil.java': The source directory does not correspond to the package declaration org.wso2.mdm.mdmmgt.util -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar (default-cli) on project wso2mdm-parent: Can not execute SonarQube analysis
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute SonarQube analysis
at org.codehaus.mojo.sonar.bootstrap.InternalMojoBootstraper.executeMojo(InternalMojoBootstraper.java:111)
at org.codehaus.mojo.sonar.bootstrap.InternalMojoBootstraper.start(InternalMojoBootstraper.java:69)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:142)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.apache.maven.plugin.MojoExecutionException: Sonar is unable to analyze file : '/var/lib/jenkins/workspace/project EMM-WSO2-V2_-_Audit qualité/modules/components/mdm-mgt/org.wso2.mdm.mdmmgt/src/main/java/org/wso2/mdm/mdmmgt/util/MDMAndroidOperationUtil.java'
at org.sonar.maven.ExceptionHandling.handle(ExceptionHandling.java:37)
at org.sonar.maven.SonarMojo.execute(SonarMojo.java:175)
at org.codehaus.mojo.sonar.bootstrap.InternalMojoBootstraper.executeMojo(InternalMojoBootstraper.java:106)
... 23 more
Caused by: org.sonar.squid.api.AnalysisException: Sonar is unable to analyze file : '/var/lib/jenkins/workspace/project EMM-WSO2-V2_-_Audit qualité/modules/components/mdm-mgt/org.wso2.mdm.mdmmgt/src/main/java/org/wso2/mdm/mdmmgt/util/MDMAndroidOperationUtil.java'
at org.sonar.java.ast.AstScanner.scan(AstScanner.java:132)
at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:113)
at org.sonar.java.JavaSquid.scan(JavaSquid.java:107)
at org.sonar.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:79)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:72)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:114)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:142)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:187)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:182)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:180)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:180)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:175)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
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:156)
at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:144)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
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)
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.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:90)
at org.sonar.maven.SonarMojo.execute(SonarMojo.java:173)
... 24 more
Caused by: org.sonar.squid.api.AnalysisException: The source directory does not correspond to the package declaration org.wso2.mdm.mdmmgt.util
at org.sonar.java.ast.visitors.PackageVisitor.checkPhysicalDirectory(PackageVisitor.java:101)
at org.sonar.java.ast.visitors.PackageVisitor.getPackageKey(PackageVisitor.java:70)
at org.sonar.java.ast.visitors.PackageVisitor.visitFile(PackageVisitor.java:39)
at com.sonar.sslr.impl.ast.AstWalker.walkAndVisit(AstWalker.java:67)
at org.sonar.java.ast.AstScanner.scan(AstScanner.java:93)
... 63 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Sonar analysis completed: FAILURE
Build step 'Sonar' changed build result to FAILURE
Build step 'Sonar' marked build as failure
Tentative d'envoi d'email vers une liste de destinataires vide. Tentative ignorée.
[BFA] Scanning build for known causes...
[BFA] Done. 0s
Finished: FAILURE
我用Google搜索了问题,我认为我需要添加
<sourceDirectory>${basedir}/src/main/java/org/wso2/mdm/mdmmgt</sourceDirectory>
但这不是正确的解决方案,它会继续停止同样的错误。
任何想法的人?
答案 0 :(得分:1)
sourceDirectory
值应该等于${basedir}/src/main/java
(了解有关Maven配置中的目录的更多信息:https://maven.apache.org/pom.html#Directories)MDMAndroidOperationUtil
类中的包名称应等于org.wso2.mdm.mdmmgt.util
。