I am working on a project, which I recently got and while running unit tests using mvn test.
So, I go to different modules and run the above command using cmd and while doing so I came to know that there are two test cases in 2 files, which are failing intermittently (this was mentioned in the comments above that methods).
So, I am thinking of skipping those test cases only and proceeding ahead for now. I tried to find it here but only thing I could find her is excluding test cases of a particular module.
I want to exclude test1() of A.java and test2() of B.java
I found below:
# Exclude one test method
mvn verify -Dtest=!LegacyTest#testFoo
# Exclude two test methods
mvn verify -Dtest=!LegacyTest#testFoo+testBar
in this link, but not sure how correct above method is and how to use it in my case, since I have not used maven before
Commands I have tried:
mvn verify -X -Dtest=!A#test1,!B#test2
mvn test -X -Dtest=!A#test1,!B#test2
Error trace which I got after running above commands:
[INFO] Selera Utils - Database ............................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.419 s
[INFO] Finished at: 2019-03-13T19:21:16+05:30
[INFO] Final Memory: 17M/205M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project log4j: No tests were executed! (Set -DfailIfNoTests=false to ignore this
error.) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project log4j: No tests were exec
uted! (Set -DfailIfNoTests=false to ignore this error.)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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.MojoFailureException: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:748)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
[ERROR]
[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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :log4j
In the link, they say this following code run multiple test :
mvn test -Dtest=AppTest,Web*
So may be to exclude multiple :
mvn verify -Dtest=!A#test1,B#test2
I didn't try, but it seems logical.
---EDIT---
You can also use the plugin maven-surefire-plugin like that
---EDIT 2 ---
I try and success, todo that verify in first that you use maven-surefire-plugin with version > 2.19 (add -X to get debug the version is printed); then your command will be :
mvn test -Dtest=!A#test1,!B#test2
Related
I am building my apps with Maven-3 and i guess after auto-refresh of maven-surefire-plugin to 3.0.0-M1 i am not able to do build and getting the below error.
As a initial step, I have cleared the directory /org/apache/maven in my repository however still i am facing the issue. Can anyone advise. Note - if i am downgrading the surefire plugin to 2.x then I am able to build it.
Error log
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.444s
[INFO] Finished at: Thu Nov 08 16:04:53 GMT 2018
[INFO] Final Memory: 60M/704M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test) on project TEST_PROJECT: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test failed: Unable to load the mojo 'test' (or one of its required components) from the plugin 'org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1': com.google.inject.ProvisionException: Guice provision errors:
[ERROR]
[ERROR] 1) No implementation for org.codehaus.plexus.languages.java.jpms.LocationManager was bound.
[ERROR] while locating org.apache.maven.plugin.surefire.SurefirePlugin
[ERROR] at ClassRealm[plugin>org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1, parent: sun.misc.Launcher$AppClassLoader#5c647e05]
[ERROR] while locating org.apache.maven.plugin.Mojo annotated with #com.google.inject.name.Named(value=org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test)
[ERROR]
[ERROR] 1 error
[ERROR] role: org.apache.maven.plugin.Mojo
[ERROR] roleHint: org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test) on project TEST_PROJECT: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test failed: Unable to load the mojo 'test' (or one of its required components) from the plugin 'org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1'
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
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:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test failed: Unable to load the mojo 'test' (or one of its required components) from the plugin 'org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1'
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.apache.maven.plugin.PluginContainerException: Unable to load the mojo 'test' (or one of its required components) from the plugin 'org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1'
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:488)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
... 20 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Guice provision errors:
1) No implementation for org.codehaus.plexus.languages.java.jpms.LocationManager was bound.
while locating org.apache.maven.plugin.surefire.SurefirePlugin
at ClassRealm[plugin>org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1, parent: sun.misc.Launcher$AppClassLoader#5c647e05]
while locating org.apache.maven.plugin.Mojo annotated with #com.google.inject.name.Named(value=org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test)
1 error
role: org.apache.maven.plugin.Mojo
roleHint: org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:257)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:245)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:455)
... 21 more
Caused by: com.google.inject.ProvisionException: Guice provision errors:
1) No implementation for org.codehaus.plexus.languages.java.jpms.LocationManager was bound.
while locating org.apache.maven.plugin.surefire.SurefirePlugin
at ClassRealm[plugin>org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1, parent: sun.misc.Launcher$AppClassLoader#5c647e05]
while locating org.apache.maven.plugin.Mojo annotated with #com.google.inject.name.Named(value=org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test)
1 error
at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:974)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:83)
at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:49)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:253)
... 23 more
You can upgrade your maven version to 3.6.0 latest to solve this issue. This can be compatible from 3.3.9 maven version.
Looking at the comments on upgrading maven version, we updated our maven version and was able to overcome the surefire plugin issue using maven 3.3.9. Didn't get any issues.
I found that my NetBeans was using a very old maven (3.0.5) even though I had a brand new maven installed.
On my Mac, I had to go to the menu "Netbeans/Preferences", select the "Maven" tab, and change from "Bundled", browsed to latest, and this got rid of the error above for me.
I had this problem until I discovered that we were not explicitly specifying the version of the surefire plugin. Once I changed our pom.xml file to set the version, it worked.
You can downgrade the version of maven-surefire-plugin to 2.12.4 using the pluginManagement tag. It worked for me.
If you are facing the issue in netbeans IDE you need to change default mavenhome version.follow the below steps
in menu bar tools->Options->click java tab --> under categories --> Execution --> Maven home drop down select manually installed location of the maven
I agree with SomMS's answer
But as an FYI, I found this thread, immediately dismissed that maven version could be the problem the as I just (last week) built this RHEL VM and it was new and shiny
... 15 minutes later I decided to check the maven version to find it was v3.0.5!
Hopefully the next guy doesn't make the same mistake
And if you are wondering how to get the version of whats installed try
mvn --version
I used #SomMS's suggestion and upgraded Maven in order to fix the issue. It worked.
The problem is that, at the time of this writing, the latest version of Maven available on CentOS 7 is 3.0.5 (default repository), which is really old (Feburary 2013). Most other distros have way newer Maven versions available to them.
My only solution was to do a manual download and add path to its binary in PATH env-variable. Downside here is that now rpm/yum are not aware of its existence.
I have this error when attempting to install the maven project:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-dependency-plugin:2.10:analyze-only
(analyze-only) on project functional-tests: Dependency
problems found -> [Help 1]
It appears right after the integration tests, during the verify phase. I can hardly guess where to look as not much other information is provided by the logs. I tried to run maven with -X argument to have a deeper look but that's the only error that appears. The last thing I see before the error appears in the detailed log is this WARNING below (that I doubt has anything to do with the error):
[WARNING] Used undeclared dependencies found:
[WARNING] javax.activation:activation:jar:1.1:test
[WARNING] Unused declared dependencies found:
[WARNING] org.slf4j:slf4j-log4j12:jar:1.7.6:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.090 s
[INFO] Finished at: 2017-06-28T10:58:54+08:00
[INFO] Final Memory: 60M/1042M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:analyze-only (analyze-only) on project functional-tests: Dependency problems found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:analyze-only (analyze-only) on project functional-tests: Dependency problems found
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:analyze-only (analyze-only) on project functional-tests: Dependency problems found
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:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
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: Dependency problems found
at org.apache.maven.plugin.dependency.analyze.AbstractAnalyzeMojo.execute(AbstractAnalyzeMojo.java:260)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
[ERROR]
[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
What could be causing this issue?
UPDATE:
I have resolved the issues that caused the warnings above and it did help removing the error. Now I only wonder why having used undeclared dependencies or declared unused dependencies are causing the whole build to fail?
UPDATE2:
Changing the slf4j scope to runtime also solved the problem.
Apparently the used undeclared dependencies warning was the culprit of my problem. After adding the dependency explicitly to the pom file, the issue was resolved.
The reason of this is:
[WARNING] Used undeclared dependencies found:
[WARNING] javax.activation:activation:jar:1.1:test
[WARNING] Unused declared dependencies found:
[WARNING] org.slf4j:slf4j-log4j12:jar:1.7.6:compile
you should remove org.slf4j:slf4j-log4j12 dependency and add javax.activation:activation dependency.
Same here, got same problem (few times for last few months) and found that fixing all warnings with Used undeclared dependencies/Unused declared dependencies fixes the issue.
My environment is the following:
http://localhost:9000/sonar/api/server/version :: 5.2
java,sonar-java-plugin-3.7.jar|07dba2b9cad37584d82522414b2dccd0
scmgit,sonar-scm-git-plugin-1.0.jar|e1d9d8e1d3524f9f0f69017e6dbead02
scmsvn,sonar-scm-svn-plugin-1.2.jar|188d526ad86ec7f2dc7de694bf5f1851
printenv | grep MAVEN<BR>
MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=512m
I launch the command:
mvn sonar:sonar -Dsonar.verbose=true
and it fails as reported here below.
If I insert the file MyFileName.java (ref. backtrace) in the SonarQube Global Source File Exclusions, then the process goes ahead, up to a next file (likely to a next file that needs to be traced because it's affected by some issue) and it fails again with the same symptoms.
There's no specific trace in the sonar.log file.
Same results with:
mvn org.codehaus.mojo:sonar-maven-plugin:2.6:sonar -Dsonar.verbose=true
The main project I'm trying to analyse is very wide and the "module" that is failing is the 103rd one; this is only to say that there are several modules already processed in the previous stages without any sonar failures.
Any suggestions on how I could investigate this issue?
Backtrace:
....
[INFO] ------------- Scan My103thModule
[INFO] Language is forced to java
[INFO] Base dir: /bla/bla/bla
[INFO] Working dir: /bla/bla/bla/target/sonar
[INFO] Source paths: pom.xml, src/main/java
[INFO] Binary dirs: target/classes
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[INFO] 1 files indexed
[INFO] Quality profile for java: Sonar way
[INFO] JaCoCoSensor: JaCoCo report not found.
[INFO] JaCoCoItSensor: JaCoCo IT report not found.
[INFO] JaCoCoOverallSensor: JaCoCo reports not found.
[INFO] Sensor JavaSquidSensor
[INFO] Java Main Files AST scan...
[INFO] 1 source files to be analyzed
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[....]
[INFO] BUILD FAILURE
[....]
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project mlwc.project: SonarQube is unable to analyze file : ' ..../MyFileName.java': NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project mlwc.project: SonarQube is unable to analyze file : ' ..../MyFileName.java'
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:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
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: SonarQube is unable to analyze file : ' ..../MyFileName.java'
at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:104)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:135)
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.sonar.squidbridge.api.AnalysisException: SonarQube is unable to analyze file : '..../MyFileName.java'
at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:105)
at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:77)
at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:130)
at org.sonar.java.JavaSquid.scan(JavaSquid.java:123)
at org.sonar.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:90)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:98)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:258)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:253)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:251)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:251)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:243)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:100)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:85)
at org.sonar.batch.bootstrap.GlobalContainer.executeAnalysis(GlobalContainer.java:153)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:110)
at org.sonar.runner.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:55)
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.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:61)
at com.sun.proxy.$Proxy21.execute(Unknown Source)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:275)
at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:166)
at org.sonar.runner.api.EmbeddedRunner.runAnalysis(EmbeddedRunner.java:153)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:99)
... 22 more
Caused by: java.lang.NullPointerException
at org.sonar.batch.source.SymbolizableBuilder.loadPerspective(SymbolizableBuilder.java:46)
at org.sonar.batch.source.SymbolizableBuilder.loadPerspective(SymbolizableBuilder.java:32)
at org.sonar.batch.deprecated.perspectives.BatchPerspectives.as(BatchPerspectives.java:63)
at org.sonar.java.SonarComponents.symbolizableFor(SonarComponents.java:111)
at org.sonar.java.model.InternalVisitorsBridge.createSonarSymbolTable(InternalVisitorsBridge.java:170)
at org.sonar.java.model.InternalVisitorsBridge.visitFile(InternalVisitorsBridge.java:104)
at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:97)
... 52 more
I also had this issue and found that upgrading (from 5.2) to SonarQube 5.3 resolved it. This suggests that the issue is related to a bug with 5.2 however I have not been able to track down the specific fix. I'll update this answer with a link to the Jira if I find it
i'm working on a "complex"/"well-structured" Maven Project, and in particular i'm working on a single internal Module of the project. I'm against a COMPILE ERROR because it seems that it doesn't find the Java Classes from an external source already linked from the Menu (right-clicking on the project) ->Build Path->Link Source.
This is a bunch of essential errors taken from the Console when i Run-> mvn : compile
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project optimizer: Compilation failure: Compilation failure:
[ERROR] /Users/Ste/Desktop/eclip/workspace/planner/src/main/java/eu/planner/Module.java:[24,19] package jmetal.core does not exist
[ERROR] /Users/Ste/Desktop/eclip/workspace/planner/src/main/java/eu/planner/Module.java:[35,29] cannot find symbol
[ERROR] symbol: class Variable
[ERROR] /Users/Ste/Desktop/eclip/workspace/planner/src/main/java/eu/planner/Module.java:[39,11] cannot find symbol
[ERROR] symbol: class Problem
[ERROR] location: class eu.planner.Module
[INFO] 100 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45.090 s
[INFO] Finished at: 2015-05-02T10:46:45+01:00
[INFO] Final Memory: 21M/219M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project optimizer: Compilation failure: Compilation failure:
[ERROR] /Users/Ste/Desktop/eclip/workspace/planner/src/main/java/eu/planner/heuristics/SVariable.java:[234,9] method does not override or implement a method from a supertype
[ERROR] /Users/Ste/Desktop/eclip/workspace/planner/src/main/java/eu/planner/heuristics/SVariable.java:[237,24] cannot find symbol
[ERROR] symbol: variable super
[ERROR] location: class eu.planner.heuristics.SVariable
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/MojoFailureException
Adding the -X it shows the DEBUG, but nothing strange. It just add at the end this information:
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project optimizer: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
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:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
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.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
[ERROR]
[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/MojoFailureException
I also tried to add in the POM of the Module i'm working on, this build helper taken from here http://mojo.codehaus.org/build-helper-maven-plugin/usage.html (without success):
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>/Users/Ste/Desktop/externalFolderWithJavaClasses<source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
Where plugin element is in /project/build/plugins and NOT in /project/build/pluginManagement/plugins.
I checked my target/classes folder of the project and it is empty.
I'm not importing files from any other projects. Just linked a folder from my filesystem.
The path you see in the screenshot is different from what you see in Compile Error because at the beginning i thought to not show my real path.
Here 2 Screenshot:
Does anyone understand what is wrong? Thank you so much
P.S. I'm using a Mac OS X x64, Eclipse Luna, and the project is Pulled from a GitHub repository if for someone this information is fundamental.
Your problem makes sense in a way. Originally, you added a source folder to your project through Eclipse, but not through maven. And when you tried to compile your maven sources, maven barfed since it couldn't find the folder you added through Eclipse.
It's a little surprising that you're still getting the same error when you use the build-helper-maven-plugin. Since that is the proper way of adding extra source folders. I think you just need to run mvn clean verify and all should be good again.
Inside of Eclipse, make sure to run Maven -> Update project... and your project should also have the proper source folders on it.
I needed to build Cloudstack from source and followed this article in the documentation. But everytime I built it with maven, I got stuck with following error. Guessing as a solution, I tried this build with oracle jdk-8, openjdk-7 and openjdk6. And also tried tomcat6 and tomcat8. But got no solution. What is going wrong? I think the reason could be a problem with a plugin but have no idea how to solve. I searched online for this error, but got no workaround.
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (compile) on project cloud-apidoc: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (compile) on project cloud-apidoc: Command execution failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
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:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
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: Command execution failed.
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:362)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:377)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:160)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:610)
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:352)
... 21 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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :cloud-apidoc
Thank you.
The latest version of cloudstack can be found from cloudstack downloads page
Do a git checkout to that version branch and then follow the developer guide you mentioned.
If version is x.y.z, the branch name would usually be x.y
The developer guide is specifically written for 4.2. You may have to adjust the java packages version according to cloudstack version.
make sure the right java versions are installed by doing
java -version and javac -version
cloudstack requires java 1.6 till 4.3 and java 1.7 for 4.4 and above
You should be using the 4.2 tag build since you followed the mentioned tutorial, I have run into a similar issue with that tag version and ended up upgrading to an onward version to resolve the case.
CloudStack has already release the 4.4 version which should resolve you problem, so you may need to update your sources to that tag and retry you build which should work without problems:
$ git fetch origin && git checkout -b 4.4.0 tags/4.4.0
$ mvn clean install -Pdeveloper,systemvm