I have a desktop Java project using Dagger2 and building with Maven. I can't run compile and package sequentially. This works:
$ mvn clean
$ mvn compile
And this works, producing an executable jar that runs without error:
$ mvn clean
$ mvn package
But this fails:
$ mvn clean
$ mvn compile
$ mvn package
When package gets to the module that uses Dagger2, it outputs:
[INFO] Changes detected - recompiling the module!
The error from mvn -e package is:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project weapon: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project weapon: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
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: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:915)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
The module has this dependency:
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>2.1</version>
<scope>compile</scope>
</dependency>
The module uses compiler plugin version 3.3 like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>2.1</version>
</dependency>
</dependencies>
<configuration>
<source>1.7</source>
<target>1.7</target>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
</configuration>
</plugin>
This is the only Dagger-related configuration. Why can't I run package after build?
Possibly related: I thought forceJavacCompilerUse was no longer needed, but without it, Dagger doesn't seem to run at all. I get an unknown symbol error on the generated component implementation (DaggerMyComponent).
Edit: This is the full output of mvn -e package, command prompt to command prompt:
kevin#aphrodite:~/Projects/IDEA/Dark Matter$ mvn -e package
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] parent
[INFO] weapon
[INFO] scripts
[INFO] assembly
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building parent 2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building weapon 2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) # weapon ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # weapon ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to /home/kevin/Projects/IDEA/Dark Matter/weapon/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] parent ............................................ SUCCESS [0.001s]
[INFO] weapon ............................................ FAILURE [1.641s]
[INFO] scripts ........................................... SKIPPED
[INFO] assembly .......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.735s
[INFO] Finished at: Fri Mar 11 04:32:38 MST 2016
[INFO] Final Memory: 21M/173M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project weapon: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project weapon: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
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: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:915)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :weapon
kevin#aphrodite:~/Projects/IDEA/Dark Matter$
Edit 2: I noticed that when I run package by itself after clean, it says it's compiling 6 sources. That's how many hand-written classes are in the project. When I run compile before package, the latter says it's compiling 8 sources. It looks like when dagger-compiler runs on a clean project, it silently generates and compiles its sources. Then package sees the new sources and tries to compile them. The mystery is why it fails. Running compile twice in a row fails in the same way.
Edit 3: I tried this answer, specifying dagger.internal.codegen.ComponentProcessor as the -processor argument. Now the first time I run compile, I see the two passes where it compiles 6 files and then 8 files:
[INFO] --- maven-compiler-plugin:3.3:compile (process-annotations) # weapon ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /home/kevin/Projects/IDEA/Dark Matter/weapon/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) # weapon ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # weapon ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to /home/kevin/Projects/IDEA/Dark Matter/weapon/target/classes
This is expected, and this compile succeeds. But then if I run package, or compile again, it fails the same as before.
The sources Dagger produces are in /target/generated-sources/annotations. I think I need to tell Maven to do something with that path, but I don't know what. It makes sense that compile detects source changes when it is run twice in a row, though I don't know why that leads to failure. Maybe I need to run the annotation processing step conditionally, but I don't know how to do that or what the condition should be.
I managed to reproduce your problem.
The key seems to be the maven-compiler-plugin:3.3
When I run with maven-compiler-plugin:3.1, the error does not manifest.
I have a hudson jobs doing the sonar stats for a maven project.
The execution of the sonar plugin fails with the following trace
[workspace] $ /hudson/hudson1/hudson/tools/maven-3.0.4/bin/mvn -f /hudson/hudson1/hudson/jobs/15_20_NX_Core_Quality/workspace/pom.xml -e -B sonar:sonar -Dsonar.jdbc.password= -Dsonar.forceAnalysis=true -Dsonar.login=admin -Dsonar.password=admin -Dsonar.jdbc.driver=net.sourceforge.jtds.jdbc.Driver -Dsonar.jdbc.url=jdbc:jtds:sqlserver://VX16:1433;databaseName=Sonar2;SelectMethod=Cursor ******** -Dsonar.host.url=http://localhost:8080/sonar ******** ********
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] NX Core
[INFO] core-entity
[INFO] core-logic
[INFO] core-ui
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building NX Core 1.22.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0
[INFO]
[INFO] --- sonar-maven-plugin:2.7.1:sonar (default-cli) # core ---
[INFO] User cache: /home/jetty/.sonar/cache
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] NX Core ........................................... FAILURE [1.414s]
[INFO] core-entity ....................................... SKIPPED
[INFO] core-logic ........................................ SKIPPED
[INFO] core-ui ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.490s
[INFO] Finished at: Wed Oct 28 14:10:38 CET 2015
[INFO] Final Memory: 14M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7.1:sonar (default-cli) on project core: Fail to download libraries from server: Status returned by url : 'http://localhost:8080/sonar/batch_bootstrap/index' is invalid : 404 -> [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 core: Fail to download libraries from server
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:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
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.MojoExecutionException: Fail to download libraries from server
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:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.IllegalStateException: Fail to download libraries from server
at org.sonar.runner.impl.Jars.dowloadFiles(Jars.java:94)
at org.sonar.runner.impl.Jars.download(Jars.java:71)
at org.sonar.runner.impl.JarDownloader.download(JarDownloader.java:40)
at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:91)
at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:87)
at org.sonar.runner.impl.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:83)
at org.sonar.runner.api.EmbeddedRunner.doStart(EmbeddedRunner.java:250)
at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:188)
at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:183)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:77)
... 22 more
Caused by: java.io.IOException: Status returned by url : 'http://localhost:8080/sonar/batch_bootstrap/index' is invalid : 404
at org.sonar.runner.impl.ServerConnection.downloadString(ServerConnection.java:95)
at org.sonar.runner.impl.ServerConnection.tryServerFirst(ServerConnection.java:163)
at org.sonar.runner.impl.ServerConnection.loadString(ServerConnection.java:142)
at org.sonar.runner.impl.Jars.dowloadFiles(Jars.java:79)
... 33 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
Finished: FAILURE
The execution of the plugin fails since 8 days, neither the pom, nor the project changed since this point of time.
sonar system specs
System date,Wed Oct 28 14:34:36 CET 2015
JVM Vendor,Oracle Corporation
JVM Name,Java HotSpot(TM) 64-Bit Server VM
JVM Version,23.6-b04
Java Version,1.7.0_10-b18
Java Home,/usr/lib/jvm/jdk1.7.0_10/jre
JIT Compiler,-
Application Server Container,Apache Tomcat/7.0.35
User Name,tomcat7
User TimeZone,Europe/Zurich
OS,Linux / amd64 / 3.2.0-92-generic
Processors,4
System Classpath,/tomcat/tomcat7/bin/bootstrap.jar:/tomcat/tomcat7/bin/tomcat-juli.jar
Boot Classpath,/usr/lib/jvm/jdk1.7.0_10/jre/lib/resources.jar:/usr/lib/jvm/jdk1.7.0_10/jre/lib/rt.jar:/usr/lib/jvm/jdk1.7.0_10/jre/lib/sunrsasign.jar:/usr/lib/jvm/jdk1.7.0_10/jre/lib/jsse.jar:/usr/lib/jvm/jdk1.7.0_10/jre/lib/jce.jar:/usr/lib/jvm/jdk1.7.0_10/jre/lib/charsets.jar:/usr/lib/jvm/jdk1.7.0_10/jre/lib/jfr.jar:/usr/lib/jvm/jdk1.7.0_10/jre/classes
Library Path,/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
Server ID,-
Version,3.4.1
Started at,Wed Oct 28 14:09:46 CET 2015
Database,Microsoft SQL Server 10.50.2500
Database URL,jdbc:jtds:sqlserver://VX16:1433/Sonar2
Database Login,sa
Database Driver,jTDS Type 4 JDBC Driver for MS SQL Server and Sybase 1.2.4
Database Driver Class,net.sourceforge.jtds.jdbc.Driver
Database Dialect (Hibernate),mssql (org.sonar.core.persistence.dialect.MsSql$MsSqlDialect)
Hibernate Default Schema,-
External User Authentication,-
Automatic User Creation,-
Allow Users to Sign Up,-
Force Authentication,-
Total Memory,445 MB
Free Memory,219 MB
Max Memory,954 MB
Heap,init = 262973312(256809K) used = 225130168(219853K) committed = 445120512(434688K) max = 954466304(932096K)
Non Heap,init = 24313856(23744K) used = 80584792(78696K) committed = 80805888(78912K) max = 136314880(133120K)
System Load Average (last minute),8.0%
Loaded Classes (currently/total/unloaded),13535 / 13535 / 0
Start Time,2015-10-28T14:09:37.964+0100
Threads (total/peak/daemon),23 / 23 / 21
Checkstyle,1.1
Cobertura,1.1
Findbugs,1.1
JaCoCo,1.1
Java,1.1
PMD,1.1
Squid for Java,1.1
Surefire,1.1
SONAR_HOME,/tomcat/sonar
awt.toolkit,sun.awt.X11.XToolkit
catalina.base,/tomcat/tomcat7
catalina.home,/tomcat/tomcat7
catalina.useNaming,true
common.loader,"${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar"
file.encoding,UTF-8
file.encoding.pkg,sun.io
file.separator,/
java.awt.graphicsenv,sun.awt.X11GraphicsEnvironment
java.awt.headless,true
java.awt.printerjob,sun.print.PSPrinterJob
java.class.path,/tomcat/tomcat7/bin/bootstrap.jar:/tomcat/tomcat7/bin/tomcat-juli.jar
java.class.version,51.0
java.endorsed.dirs,/tomcat/tomcat7/endorsed
java.ext.dirs,/usr/lib/jvm/jdk1.7.0_10/jre/lib/ext:/usr/java/packages/lib/ext
java.home,/usr/lib/jvm/jdk1.7.0_10/jre
java.io.tmpdir,/tmp/tomcat7-tmp
java.library.path,/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
java.naming.factory.initial,org.apache.naming.java.javaURLContextFactory
java.naming.factory.url.pkgs,org.apache.naming
java.runtime.name,Java(TM) SE Runtime Environment
java.runtime.version,1.7.0_10-b18
java.specification.name,Java Platform API Specification
java.specification.vendor,Oracle Corporation
java.specification.version,1.7
java.util.logging.config.file,/tomcat/tomcat7/conf/logging.properties
java.util.logging.manager,org.apache.juli.ClassLoaderLogManager
java.vendor,Oracle Corporation
java.vendor.url,http://java.oracle.com/
java.vendor.url.bug,http://bugreport.sun.com/bugreport/
java.version,1.7.0_10
java.vm.info,mixed mode
java.vm.name,Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.name,Java Virtual Machine Specification
java.vm.specification.vendor,Oracle Corporation
java.vm.specification.version,1.7
java.vm.vendor,Oracle Corporation
java.vm.version,23.6-b04
jruby.management.enabled,true
line.separator,"
"
org.apache.catalina.startup.ContextConfig.jarsToSkip,""
org.apache.catalina.startup.TldConfig.jarsToSkip,""
os.arch,amd64
os.name,Linux
os.version,3.2.0-92-generic
package.access,sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper."""
package.definition,"sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper."
path.separator,:
server.loader,""
shared.loader,""
sun.arch.data.model,64
sun.boot.class.path,/usr/lib/jvm/jdk1.7.0_10/jre/lib/resources.jar:/usr/lib/jvm/jdk1.7.0_10/jre/lib/rt.jar:/usr/lib/jvm/jdk1.7.0_10/jre/lib/sunrsasign.jar:/usr/lib/jvm/jdk1.7.0_10/jre/lib/jsse.jar:/usr/lib/jvm/jdk1.7.0_10/jre/lib/jce.jar:/usr/lib/jvm/jdk1.7.0_10/jre/lib/charsets.jar:/usr/lib/jvm/jdk1.7.0_10/jre/lib/jfr.jar:/usr/lib/jvm/jdk1.7.0_10/jre/classes
sun.boot.library.path,/usr/lib/jvm/jdk1.7.0_10/jre/lib/amd64
sun.cpu.endian,little
sun.cpu.isalist,""
sun.font.fontmanager,sun.awt.X11FontManager
sun.io.unicode.encoding,UnicodeLittle
sun.java.command,org.apache.catalina.startup.Bootstrap start
sun.java.launcher,SUN_STANDARD
sun.jnu.encoding,UTF-8
sun.management.compiler,HotSpot 64-Bit Tiered Compilers
sun.os.patch.level,unknown
tomcat.util.buf.StringCache.byte.enabled,true
tomcat.util.scan.DefaultJarScanner.jarsToSkip,"bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-tribes.jar,jasper.jar,jasper-el.jar,ecj-*.jar,tomcat-api.jar,tomcat-util.jar,tomcat-coyote.jar,tomcat-dbcp.jar,tomcat-jni.jar,tomcat-spdy.jar,tomcat-i18n-en.jar,tomcat-i18n-es.jar,tomcat-i18n-fr.jar,tomcat-i18n-ja.jar,tomcat-juli-adapters.jar,catalina-jmx-remote.jar,catalina-ws.jar,tomcat-jdbc.jar,commons-beanutils*.jar,commons-codec*.jar,commons-collections*.jar,commons-dbcp*.jar,commons-digester*.jar,commons-fileupload*.jar,commons-httpclient*.jar,commons-io*.jar,commons-lang*.jar,commons-logging*.jar,commons-math*.jar,commons-pool*.jar,jstl.jar,geronimo-spec-jaxrpc*.jar,wsdl4j*.jar,ant.jar,ant-junit*.jar,aspectj*.jar,jmx.jar,h2*.jar,hibernate*.jar,httpclient*.jar,jmx-tools.jar,jta*.jar,log4j*.jar,mail*.jar,slf4j*.jar,xercesImpl.jar,xmlParserAPIs.jar,xml-apis.jar,access-bridge.jar,access-bridge-64.jar,dnsns.jar,jaccess.jar,ldapsec.jar,localedata.jar,sunjce_provider.jar,sunmscapi.jar,sunpkcs11.jar,jhall.jar,tools.jar,sunec.jar,zipfs.jar,gnome-java-bridge.jar,pulse-java.jar,apple_provider.jar,AppleScriptEngine.jar,CoreAudio.jar,dns_sd.jar,j3daudio.jar,j3dcore.jar,j3dutils.jar,jai_core.jar,jai_codec.jar,mlibwrapper_jai.jar,MRJToolkit.jar,vecmath.jar,junit.jar,junit-*.jar,ant-launcher.jar"
user.country,US
user.dir,/tomcat/tomcat7
user.home,/home/tomcat7
user.language,en
user.name,tomcat7
user.timezone,Europe/Zurich
Any help is appreciated.
thanks
Too bad 2.7.1 is not back-compatible.
Lock your plugin version to 2.6 in your pom.xml or upgrade your SonarQube
http://docs.sonarqube.org/display/HOME/Frequently+Asked+Questions
You're using a very very old version of SonarQube. I highly recommend you to upgrade. If you still want to remain on your version of SonarQube, you can try to downgrade sonar-maven-plugin to version 2.6.
I am following the Maven by example guide to learn Maven.
I am busy working through chapter 7, which is a simple multimodule enterprise project containing spring and hibernate. The example files for this chapter can be downloaded here, in the ch-multi-spring directory.
Sections 7.1 to 7.6 talk about the specifics of each module. In section 7, the database is generated and the application is run. It is at this step that I receive the following error:
> mvn hibernate3:hbm2ddl -X
<Some output left out>
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Multi-Spring Chapter Simple Parent Project ........ FAILURE [0.752s]
[INFO] Multi-Spring Chapter Simple Object Model .......... SKIPPED
[INFO] Multi-Spring Chapter Simple Weather API ........... SKIPPED
[INFO] Multi-Spring Chapter Simple Persistence API ....... SKIPPED
[INFO] Multi-Spring Chapter Simple Command Line Tool ..... SKIPPED
[INFO] Multi-Spring Chapter Simple Web Application ....... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.330s
[INFO] Finished at: Thu Apr 24 15:31:18 CEST 2014
[INFO] Final Memory: 9M/154M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:3.0:hbm2ddl (default-cli) on project simple-parent: There was an error creating the AntRun task. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:3.0:hbm2ddl (default-cli) on project simple-parent: There was an error creating the AntRun task.
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: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:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
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: There was an error creating the AntRun task.
at org.codehaus.mojo.hibernate3.AbstractHibernateMojo.execute(AbstractHibernateMojo.java:84)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.NullPointerException
at org.codehaus.plexus.configuration.DefaultPlexusConfiguration.add(DefaultPlexusConfiguration.java:175)
at org.codehaus.plexus.configuration.DefaultPlexusConfiguration.addChild(DefaultPlexusConfiguration.java:151)
at org.codehaus.mojo.hibernate3.util.PlexusConfigurationUtils.setHibernateConfiguration(PlexusConfigurationUtils.java:289)
at org.codehaus.mojo.hibernate3.util.PlexusConfigurationUtils.parseHibernateTool(PlexusConfigurationUtils.java:67)
at org.codehaus.mojo.hibernate3.AbstractHibernateToolMojo.getConfiguration(AbstractHibernateToolMojo.java:60)
at org.codehaus.mojo.hibernate3.AbstractHibernateMojo.execute(AbstractHibernateMojo.java:76)
... 21 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
Since I'm still learning Maven, and not familiar with Hibernate, I have no idea what the problem could be. I haven't changed anything in the downloaded example files.
I was getting the same error.
I modified the version number of hibernate3-maven-plugin plugin:
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<!-- insted of 2.1 as documented inside the Maven by example guide -->
<version>2.2</version>
....
</groupId>
And this fixed the issue. Moreover, I'm using JDK 1.8. Below the 'mvn -v' output:
Java version: 1.8.0_20, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_20\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
I figured out the answer.
Here is the summary of my findings:
the mvn hibernate3:hbm2ddl command should be run from the simple-webapp or simple-command folder. (The specification for the plugin should be present in the POM for that module.)
increasing the hibernate3-maven-plugin version to 3.0 will reintroduce the problem, I believe I read some posts that the configuration format had been changed, but I didn't look further into it.
the mvn hibernate3:hbm2ddl will report the error shown below if JAVA_HOME is set to JDK1.7 instead of 1.6 (Found solution to this here)
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:2.1:hbm2ddl (default-cli) on project simple-command: Could not get ConfigurationTask.