Compiling Error in Maven - maven

Seeing compilation error in maven. Checked and tried all the workarounds which i got from google and stack* sites. but still i couldnt resolve.
Installed maven 3.3.3 and its supported version of java which is 1.7. Please note i haven't set JAVA_HOME, M2 and M2_HOME environment variables. but still takes the path.
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T07:57:37-04:00)
Maven home: /usr/local/apache-maven-3.3.3
Java version: 1.7.0_85, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-573.3.1.el6.x86_64", arch: "amd64", family: "unix"
Errors are
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/sdiuser/Build-Release/hg-artifactid/src/main/java/hg-groupid/App.java:[1,11] ';' expected
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.007 s
[INFO] Finished at: 2015-08-31T02:43:32-04:00
[INFO] Final Memory: 9M/158M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project hg-artifactid: Compilation failure
[ERROR] /home/sdiuser/Build-Release/hg-artifactid/src/main/java/hg-groupid/App.java:[1,11] ';' expected
[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 hg-artifactid: Compilation failure
/home/sdiuser/Build-Release/hg-artifactid/src/main/java/hg-groupid/App.java:[1,11] ';' expected
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: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: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.compiler.CompilationFailureException: Compilation failure
/home/sdiuser/Build-Release/hg-artifactid/src/main/java/hg-groupid/App.java:[1,11] ';' expected
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:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more

Going out on a limb here... but does line 1 of App.java contain the following package definition:
package hg-groupid;
If so, the problem relates to the hyphen you have in the package name - Java identifiers are not permitted to contain a hyphen in their name - you may wish to change this to an underscore.
See also: Hyphenated company name in Java packages

Related

AEM Sites: Filter update fails while updating design rules using maven build

I'm are trying to set design rules in AEM 6.5 under the new content structure /apps/settings/wcm/design. When building code, I am observing below error:
Build Command:  mvn -PautoInstallPackage clean install -X
[INFO] --- filevault-package-maven-plugin:1.0.3:generate-metadata (default-generate-metadata) # placeholder-com.ui.apps ---
[INFO] Embedding --- Embedded: groupId=com.adobe.cq,artifactId=core.wcm.components.core,type=,classifier=,filter=false,excludeTransitive=false,target=/apps/placeholder-com/install/ ---
[INFO] Embedding com.adobe.cq:core.wcm.components.core:jar:2.7.0 (from /Users/user-name/.m2/repository/com/adobe/cq/core.wcm.components.core/2.7.0/core.wcm.components.core-2.7.0.jar) -> jcr_root/apps/placeholder-com/install/core.wcm.components.core-2.7.0.jar
[INFO] Embedding --- Embedded: groupId=com.placeholder.aem,artifactId=placeholder-com.core,type=,classifier=,filter=false,excludeTransitive=false,target=/apps/placeholder-com/install/ ---
[INFO] Embedding com.placeholder.aem:placeholder-com.core:jar:0.0.1-SNAPSHOT (from /Users/user-name/Projects/placeholder/placeholder-dot-com/aem-placeholder-site/core/target/placeholder-com.core-0.0.1-SNAPSHOT.jar) -> jcr_root/apps/placeholder-com/install/placeholder-com.core-0.0.1-SNAPSHOT.jar
[INFO] using meta-inf/vault from /Users/user-name/Projects/placeholder/placeholder-dot-com/aem-placeholder-site/ui.apps/src/main/content/META-INF/vault
[INFO] Loading filter from /Users/user-name/Projects/placeholder/placeholder-dot-com/aem-placeholder-site/ui.apps/src/main/content/META-INF/vault/filter.xml
[INFO] Merged detected packages from analyzer with 'importPackage':
[INFO] com.adobe.cq.sightly;version="[3.2.0,4.0.0)"
[INFO] org.apache.sling.api;version="[2.3.3,3.0.0)"
[INFO] org.apache.sling.scripting.sightly.pojo;version="[1.0.1,2.0.0)"
[INFO]
[ERROR] 1 error(s) detected during dependency analysis.
[ERROR] Filter root's ancestor '/apps/settings/wcm/design' is not covered by any of the specified dependencies.Ï
[ERROR] Failed to execute goal org.apache.jackrabbit:filevault-package-maven-plugin:1.0.3:generate-metadata (default-generate-metadata) on project placeholder-com.ui.apps: 1 error(s) detected during dependency analysis. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.jackrabbit:filevault-package-maven-plugin:1.0.3:generate-metadata (default-generate-metadata) on project placeholder-com.ui.apps: 1 error(s) detected during dependency analysis.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
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:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
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.MojoExecutionException: 1 error(s) detected during dependency analysis.
at org.apache.jackrabbit.filevault.maven.packaging.GenerateMetadataMojo.validateDependencies(GenerateMetadataMojo.java:617)
at org.apache.jackrabbit.filevault.maven.packaging.GenerateMetadataMojo.execute(GenerateMetadataMojo.java:428)
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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :placeholder-com.ui.apps
Project filter.xml:
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/placeholder-com"/>
<filter root="/apps/msm/placeholder-com_blueprint" mode="merge"/>
<filter root="/apps/settings/wcm/designs/placeholder-com"/>
</workspaceFilter>
FYI, I did not make any modifications to pom.xml.
I really appreciate the help here.
Thanks!
Thanks to our architect.
Adding the filter for the artifact filevault-package-maven-plugin in the pom.xml for repository-structure project fixed the issue.
<filter><root>/apps/settings/wcm/designs</root></filter>

Error on deploying to artifactory using maven

I tried to deploy a artifact to artifactory using maven. But I am getting an error
[WARNING] Error injecting: org.apache.maven.plugin.deploy.DeployFileMojo
java.lang.NoClassDefFoundError: org/codehaus/plexus/util/xml/XmlStreamWriter
Detailed Logs are
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy-file (default-cli) # standalone-pom ---
[WARNING] Error injecting: org.apache.maven.plugin.deploy.DeployFileMojo
java.lang.NoClassDefFoundError: org/codehaus/plexus/util/xml/XmlStreamWriter
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getDeclaredConstructors(Class.java:2020)
at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:99)
at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:657)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:875)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:798)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:281)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:213)
at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:998)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1031)
at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:994)
at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1044)
at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:54)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:115)
at org.eclipse.sisu.bean.BeanScheduler$Activator.onProvision(BeanScheduler.java:176)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:126)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:46)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1009)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1059)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1005)
at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:36)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:546)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
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: java.lang.ClassNotFoundException: org.codehaus.plexus.util.xml.XmlStreamWriter
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 55 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.555 s
[INFO] Finished at: 2015-12-30T06:23:49+00:00
[INFO] Final Memory: 13M/360M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli) on project standalone-pom: Execution default-cli of goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file failed: A required class was missing while executing org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file: org/codehaus/plexus/util/xml/XmlStreamWriter
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-deploy-plugin:2.7
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/var/mware/.m2/repository/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.jar
[ERROR] urls[1] = file:/var/mware/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------: org.codehaus.plexus.util.xml.XmlStreamWriter
[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/PluginContainerException
So any help in this issue?
My advice would be to update your version of the maven-deploy-plugin. There is a much newer version - 2.8.2. There's also Maven 3.3.9 as well. This seems like a Plexus issue.
This is an old question but just in case someone ends up here trying to find help:
This error is caused by Maven resolving a dependency (org.codehaus.plexus:plexus-utils) to an older version, probably 1.x where the class is simply not there.
This problem is caused most probably because on your (proxy) Nexus server maven-deploy-plugin has a generated pom file or even none, and it cannot resolve the dependencies correctly, so it falls back to plexus-utils:1.x
Solution: Download the original pom file and deploy it to your Nexus server (deploy:deploy-file). If your deploy plugin does not work anymore because of the corrupted dependency path, trick it by copying the pom file first in your local repository.

Maven test error: javac: source release 1.8 requires target release 1.8 [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
If I run mvn -e test, I get the error:
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Skat09 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact org.apache.commons:commons-io:jar:1.3.2 has been relocated to commons-io:commons-io:jar:1.3.2
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Skat09 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources
[INFO] Copying 191 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # Skat09 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 64 source files to /home/buzz-dee/Workspace/skat09/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] javac: source release 1.8 requires target release 1.8
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.729 s
[INFO] Finished at: 2015-10-02T23:17:02+02:00
[INFO] Final Memory: 10M/298M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project Skat09: Compilation failure
[ERROR] javac: source release 1.8 requires target release 1.8
[ERROR] -> [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 Skat09: Compilation failure
javac: source release 1.8 requires target release 1.8
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: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.compiler.CompilationFailureException: Compilation failure
javac: source release 1.8 requires target release 1.8
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:911)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
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] 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
This is my Maven pom.xml:
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<rules>
<requireJavaVersion>
<version>1.8</version>
</requireJavaVersion>
</rules>
<source>1.8</source>
<tagret>1.8</tagret>
</configuration>
</plugin>
</plugins>
The output from mvn -version:
Apache Maven 3.3.3 (NON-CANONICAL_2015-07-27T12:38:38_root; 2015-07-27T11:38:38+02:00)
Maven home: /opt/maven
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-jdk/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "4.2.2-1-arch", arch: "amd64", family: "unix"
Java JDK (archlinux-java get) setting:
java-8-jdk
Java compiler version (javac -version):
javac 1.8.0_60
I also tried to add:
<verbose>true</verbose>
<fork>true</fork>
<executable>/usr/lib/jvm/java-8-jdk/bin/javac</executable>
<compilerVersion>1.8</compilerVersion>
to the configuration element of the maven-compiler-plugin in the POM.
What is problem for the above error and how can I solve it?
you made a typo: <tagret>1.8</tagret> should be <target>1.8</target>

java.nio.file.NoSuchFileException and java.io.EOFException when tring to build Jenkins Plugin from source

I am tring to build Cucumber Test Result Plugin (0.8.2) and I am receiving the following error after mvn package:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] error: java.nio.file.NoSuchFileException: /home/chrisandrew/sources/cucumber-testresult-plugin/target/classes/META-INF/exposed.stapler-beans
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.527s
[INFO] Finished at: Thu Aug 20 17:33:31 BST 2015
[INFO] Final Memory: 27M/92M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5:compile (default-compile) on project cucumber-testresult-plugin: Compilation failure
[ERROR] error: java.nio.file.NoSuchFileException: /home/chrisandrew/sources/cucumber-testresult-plugin/target/classes/META-INF/exposed.stapler-beans
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5:compile (default-compile) on project cucumber-testresult-plugin: Compilation failure
error: java.nio.file.NoSuchFileException: /home/chrisandrew/sources/cucumber-testresult-plugin/target/classes/META-INF/exposed.stapler-beans
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:504)
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.CompilationFailureException: Compilation failure
error: java.nio.file.NoSuchFileException: /home/chrisandrew/sources/cucumber-testresult-plugin/target/classes/META-INF/exposed.stapler-beans
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:729)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
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]
[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 tried "resolving" these errors by creating two empty files target/classes/META-INF/exposed.stapler-beans and target/classes/META-INF/annotations/hudson.Extension (don't know if I should have done this, probably not...) and now I get this:
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] error: java.io.EOFException
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.443s
[INFO] Finished at: Thu Aug 20 16:48:45 BST 2015
[INFO] Final Memory: 27M/91M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5:compile (default-compile) on project cucumber-testresult-plugin: Compilation failure
[ERROR] error: java.io.EOFException
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5:compile (default-compile) on project cucumber-testresult-plugin: Compilation failure
error: java.io.EOFException
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:504)
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.CompilationFailureException: Compilation failure
error: java.io.EOFException
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:729)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
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]
[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
mvn -v output:
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T08:57:37-03:00)
Maven home: /opt/apache-maven-3.3.3
Java version: 1.9.0-ea, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-9-oracle
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.19.0-25-generic", arch: "amd64", family: "unix"
What am I doing wrong?
Got the same error with java-9, compiled successfully using oracle jdk 1.8

Maven by example - NullPointer executing hibernate3:hbm2ddl

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.

Resources