m2e shows error in execution for jaxb2-maven-plugin schemagen goal - maven

I am using maven and the jaxb2-maven-plugin version 2.2 to generate the xsd by calling the goal schemagen.
Everything works find both when I run maven from the command line or when I run it within eclipse using m2e. So far so good.
Unfortunately, in eclipse an error/exception in the pom file is shown:
Execution serviceConfigs-schemagen of goal org.codehaus.mojo:jaxb2-maven-plugin:2.2:schemagen failed. (org.codehaus.mojo:jaxb2-maven-plugin:2.2:schemagen:serviceConfigs-schemagen:generate-resources)
org.apache.maven.plugin.PluginExecutionException: Execution serviceConfigs-schemagen of goal org.codehaus.mojo:jaxb2-maven-plugin:2.2:schemagen failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360)
at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52)
at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:172)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:115)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:105)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:86)
at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:200)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:735)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:301)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:304)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:360)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:383)
at org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:487)
at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:406)
at org.eclipse.ui.actions.BuildAction$1.runInWorkspace(BuildAction.java:285)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: java.lang.NullPointerException
at org.codehaus.mojo.jaxb2.shared.environment.ToolExecutionEnvironment.restore(ToolExecutionEnvironment.java:182)
at org.codehaus.mojo.jaxb2.schemageneration.AbstractXsdGeneratorMojo.performExecution(AbstractXsdGeneratorMojo.java:528)
at org.codehaus.mojo.jaxb2.AbstractJaxbMojo.execute(AbstractJaxbMojo.java:257)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 33 more
If I perform a Maven --> Update Project the error disappears for a while, however as soon as i build the project it appears again.
Does somebody knows how to get rip or this error message?
Thanks in advance
Javi

Seems it was realted to a bug in that version of the plugin. Updating the plugin to version 2.4 has solved the issue for me.

Related

Xtext maven build with project wizard of example project

Hello I tried to build the example xtext project via maven by using the project wizard, adding feature and update site and choosing maven build. To overcome another error I changed Tycho version to 2.3.0 . I now get the following build error I just cant get rid of:
[INFO] --- exec-maven-plugin:1.6.0:java (mwe2Launcher) # org.xtext.example.mydsl ---
0 [org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main()] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - com.google.inject.internal.util.$ComputationException: java.lang.ExceptionInInitializerError
com.google.inject.internal.util.$ComputationException: com.google.inject.internal.util.$ComputationException: java.lang.ExceptionInInitializerError
at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553)
at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419)
at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
at com.google.inject.internal.FailableCache.get(FailableCache.java:50)
at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:49)
at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:125)
at com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:507)
at com.google.inject.internal.AbstractBindingProcessor$Processor$1.run(AbstractBindingProcessor.java:159)
at com.google.inject.internal.ProcessedBindingData.initializeBindings(ProcessedBindingData.java:44)
at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:122)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:72)
at com.google.inject.Guice.createInjector(Guice.java:62)
at org.eclipse.emf.mwe2.language.Mwe2StandaloneSetupGenerated.createInjector(Mwe2StandaloneSetupGenerated.java:47)
at org.eclipse.emf.mwe2.language.Mwe2StandaloneSetupGenerated.createInjectorAndDoEMFRegistration(Mwe2StandaloneSetupGenerated.java:41)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:76)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:37)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
at java.base/java.lang.Thread.run(Thread.java:831)
I changed the version of the coresponding exec-maven-plugin but didnt help. Any idea? And maybe an generic idea how to debug that kind of errors? Thank you!

SonarQube with Jacoco (with Gradle ) execution fails [duplicate]

I recently tried to upgrade my Gradle build to SonarQube plugin 2.2 and encountered the following error:
Caused by: java.lang.IllegalStateException: No files nor directories matching '[/opt/bamboo-home/xml-data/build-dir/SPR-SONAR-JOB1/spring-core/build/libs/spring-cglib-repack-3.2.4.jar' in directory /opt/bamboo-home/xml-data/build-dir/SPR-SONAR-JOB1/spring-aop
org.sonar.batch.scan.ProjectReactorBuilder.validateDirectories(ProjectReactorBuilder.java:302)
org.sonar.batch.scan.ProjectReactorBuilder.loadChildProject(ProjectReactorBuilder.java:217)
org.sonar.batch.scan.ProjectReactorBuilder.defineChildren(ProjectReactorBuilder.java:192)
org.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:116)
org.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:120)
org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:98)
org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91)
org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:125)
org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:173)
org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.executeOldVersion(BatchIsolatedLauncher.java:70)
org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
com.sun.proxy.$Proxy77.executeOldVersion(Unknown Source)
org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:238)
org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
org.sonarqube.gradle.SonarQubeTask.run(SonarQubeTask.java:93)
This spring-cglib-repack-3.2.4.jar does exist in the spring-core/build/libs/ folder, since my build is repackaging the cglib dependency in a custom jarjar task.
It seems the plugin is looking for that resource under the spring-aop folder, hence the exception.
Note that the same configuration works with the 2.1 version.
I had to put path to the class files
sonar.java.binaries=target/
sonar-project.properties
Sonar version 6.2
A pull request was submitted to fix this issue. I have created a ticket and will release a bugfix:
https://jira.sonarsource.com/browse/SONARGRADL-30

"IllegalStateException: No files nor directories matching" for non-existing JAR

I recently tried to upgrade my Gradle build to SonarQube plugin 2.2 and encountered the following error:
Caused by: java.lang.IllegalStateException: No files nor directories matching '[/opt/bamboo-home/xml-data/build-dir/SPR-SONAR-JOB1/spring-core/build/libs/spring-cglib-repack-3.2.4.jar' in directory /opt/bamboo-home/xml-data/build-dir/SPR-SONAR-JOB1/spring-aop
org.sonar.batch.scan.ProjectReactorBuilder.validateDirectories(ProjectReactorBuilder.java:302)
org.sonar.batch.scan.ProjectReactorBuilder.loadChildProject(ProjectReactorBuilder.java:217)
org.sonar.batch.scan.ProjectReactorBuilder.defineChildren(ProjectReactorBuilder.java:192)
org.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:116)
org.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:120)
org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:98)
org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:91)
org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:125)
org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:173)
org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.executeOldVersion(BatchIsolatedLauncher.java:70)
org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
com.sun.proxy.$Proxy77.executeOldVersion(Unknown Source)
org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:238)
org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
org.sonarqube.gradle.SonarQubeTask.run(SonarQubeTask.java:93)
This spring-cglib-repack-3.2.4.jar does exist in the spring-core/build/libs/ folder, since my build is repackaging the cglib dependency in a custom jarjar task.
It seems the plugin is looking for that resource under the spring-aop folder, hence the exception.
Note that the same configuration works with the 2.1 version.
I had to put path to the class files
sonar.java.binaries=target/
sonar-project.properties
Sonar version 6.2
A pull request was submitted to fix this issue. I have created a ticket and will release a bugfix:
https://jira.sonarsource.com/browse/SONARGRADL-30

SonarQube Nullpointer on analysis, missing fields or rules parameters

I'm running into a nullpointer exception when running analysis on a java project.
The condition that triggers the analysis failure only happens when I activate certain Rules in the Quality Profile. Particularly, any rule that has a parameter you can override, causes the nullpointer failure. It fails whether or not I provide an override value or if the parameter is left default.
I should note that I can get successful analysis to complete if those particular rules are deactivated in the quality profile. It only seems to be related to certain rules that have parameters.
I can replicate this Nullpointer failure with both the sonar-runner, and the org.sonarqube gradle plugin (v 1.0). So I suspect it is not a problem with the runner or the plugin but some kind of setup issue with the SonarQube server and/or database.
The problem is, I don't know how to go in and fix this issue. The SonarQube database isn't documented (that I'm aware) I suspect that there is something maybe missing in the database but I'm not even sure where they might be.
Any suggestions on where I might look?
Versions:
SonarQube 4.5.2
SonarQube Runner 2.4
Java 1.8.0_40 Oracle Corporation (64-bit)
Mac OS X 10.10.4 x86_64
Here is the stack trace of the error:
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 1:43.316s
Final Memory: 27M/635M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
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.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.NullPointerException
at org.sonar.api.batch.rule.Checks.getField(Checks.java:180)
at org.sonar.api.batch.rule.Checks.configureFields(Checks.java:167)
at org.sonar.api.batch.rule.Checks.instantiate(Checks.java:152)
at org.sonar.api.batch.rule.Checks.addAnnotatedChecks(Checks.java:127)
at org.sonar.java.SonarComponents.registerTestCheckClasses(SonarComponents.java:128)
at org.sonar.plugins.java.JavaSquidSensor.analyse(JavaSquidSensor.java:82)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:119)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:194)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:233)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:228)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:221)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
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:125)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:173)
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:48)
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.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
We solved the problem, and the problem was indeed the Java plugin on the SonarQube server. The solution was to downgrade the Java plugin though. Here are the versions we ended up using:
Checkstyle [checkstyle] 2.2 Analyze Java code with Checkstyle.
Clover [clover] 3.0 Get code coverage with Atlassian Clover.
Cobertura [cobertura] 1.6.3 Get code coverage with Cobertura.
Findbugs [findbugs] 3.1 Analyze Java code with Findbugs 3.0.0.
Java [java] 2.9.1 SonarQube rule engine.
JIRA [jira] 1.2 Connects SonarQube to Atlassian JIRA in various ways.
LDAP [ldap] 1.4 Delegates authentication to LDAP.
PMD [pmd] 2.3 Analyze Java code with PMD.

error when running apache hector-example

I am new in apache Cassandra.
I have installed Apache Cassandra 1.2.5 and Apache Maven. Right now I just want to run the hector-examples posted by zznate in github.com. I am using Mac iOS.
I cloned the hector-examples folder into my local folder, and used the command
mvn -e exec:java -Dexec.mainClass="com.riptano.cassandra.hector.example.InsertSingleColumn"
Built failure.
Is there any steps that I am missing? Thank you very much.
ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1:java (default-cli) on project hector-examples: An exception occured while executing the Java class. com.riptano.cassandra.hector.example.InsertSingleColumn -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1:java (default-cli) on project hector-examples: An exception occured while executing the Java class. com.riptano.cassandra.hector.example.InsertSingleColumn
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)...
Caused by: java.lang.ClassNotFoundException: com.riptano.cassandra.hector.example.InsertSingleColumn
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:283)
at java.lang.Thread.run(Thread.java:680)
I think this has something to do with Maven build.
Can you try these steps:
mvn clean install
mvn -e exec:java -Dexec.mainClass="com.riptano.cassandra.hector.example.InsertSingleColumn"
If you are willing to look for other options, astyanax is an excellent choice for querying/ working with cassandra cluster. You can look for examples here.
Just add the maven dependency or jars in your project and it should be pretty straightforward from there on.
Another option is Datastax java driver. If you've worked with SQL, cassandra has similar querying language called CQL which is amazingly simple and good to use.
Examples available here.
And this is how you insert dataINSERT INTO users
(user_name, password)
VALUES ('jsmith', 'ch#ngem3a');

Resources