I am using Eclipse 3.5 (Galileo) with m2eclipse and GWT Eclipse plugins installed. I created a project using the gwt-maven-plugin archetype. I have created an RPC service defined with these classes:
my.package.client.DataService
my.package.client.DataServiceAsync
my.package.server.DataServiceImpl
When I run mvn clean, the target directory is removed (as exepected). When I run gwt:compile gwt:run -X -e, I get the error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project MyProject: Compilation failure
C:\Devel\EclipseProjects\MyProject\target\generated-sources\gwt\my\package\client\DataServiceAsync.java:[8,7] duplicate class: my.project.client.DataServiceAsync
-> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project MyProject: Compilation failure
C:\Devel\EclipseProjects\MyProject\target\generated-sources\gwt\my\package\client\DataServiceAsync.java:[8,7] duplicate class: my.project.client.DataServiceAsync
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:581)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeForkedExecutions(DefaultLifecycleExecutor.java:685)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:560)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:324)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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.CompilationFailureException: Compilation failure
C:\Devel\EclipseProjects\MyProject\target\generated-sources\gwt\my\package\client\DataServiceAsync.java:[8,7] duplicate class: my.project.client.DataServiceAsync
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:577)
... 16 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
After the failure, the target directory has been created with the following directory structure and the single file in it as such:
MyProject/target/generated-sources/gwt/my/project/client/DataServiceAsync.java
Since the target directory didn't exist before running gwt:compile gwt:run -X -e, the directories must have been created and the java class copied as part of executing the goal. So, why would the goal now complain about a duplicate class?
Any help is greatly appreciated!
I have found this posting which states:
If you manually create the Async interface you must disable the generateAsync goal in the plugin configuration
The fix was to remove <goal>generateAsync</goal> from my pom.xml. The plugin config now looks like:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>my.package.Application/Application.html</runTarget>
</configuration>
</plugin>
You might actually have generated a duplicate class.
There is a "generateAsync" goal in pom.xml which takes care of generating Async classes for each service You create. If You have this You DO NOT NEED to create a Async version manually.
If You do then You will get "Duplicate Class" error.
Related
Did a fresh install of Eclipse 4.9, and can no longer build my Java project within Eclipse (still builds fine from command line).
The console output does not give me much to go on... just complains about the plugin...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project myprojectcommon: Compilation failure -> [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 myprojectcommon: Compilation failure
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:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
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:862)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
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.
I'm running Eclipse 4.9 on OSX High Sierra, w/ JDK 1.8_191. Maven version is 3.5.4, and Eclipse is configured to use this external Maven. JAVA_HOME and M2_HOME are set (though I don't think they are needed for OSX). I have tried building my existing workspace as well as importing the project into a fresh one.
Kind of at wit's end here... any help would be greatly appreciated.
EDIT 1: Then using a Terminal inside Eclipse, it does not recognize the mvn command, nor does it see any system variables like M2_HOME. Eclipse itself is configured to use my external maven installation, but I have also tried using the embedded. In both cases, Eclipse Terminal does not recognize mvn.
Try to locate and delete .m2/repository local repository. It should solve the problem !
if you are using Java 8, in your pom.xml, try adding this:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
Or configure in plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>your maven compiler plugin version</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
Fix: Eclipse needs to be launched from command line in order for PATH and other Env Vars to be picked up
Steps:
Created a new script called eclipseLauncher and made it executable (chmod 755)
#!/bin/bash
/Applications/eclipse/jee-2018-09/Eclipse.app/Contents/MacOS/eclipse &
Turned script into an app:
a. Create an AppleScript (save as type .app) that points to the launcher script…
do shell script "open /Applications/eclipse/scripts/eclipseLauncher"
b. This app can then be moved to the dock and executed from there
NOTE: The app executes a script rather than directly issuing the commands. When I simply ran the command from the app, I could not get the terminal window to close after Eclipse was launched. Only by invoking the script could I get it to work like I wanted.
I am trying to integrate OpenClover into my project.
I have a Java based webapp and I use maven
I have setup the plugin as follows
<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>4.2.0</version>
<configuration>
<targetPercentage>50%</targetPercentage>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
When I run the following command
mvn clean test clover:aggregate clover:clover -Dsurefire.skip.tests=false;
I get this error
[ERROR] Failed to execute goal org.openclover:clover-maven-plugin:4.2.0:setup (default-cli) on project fcservices-web: Execution default-cli of goal org.openclover:clover-maven-plugin:4.2.0:setup failed: Unable to load the mojo 'setup' (or one of its required components) from the plugin 'org.openclover:clover-maven-plugin:4.2.0': com.google.inject.ProvisionException: Guice provision errors:
[ERROR]
[ERROR] 1) No implementation for org.apache.maven.execution.MavenSession was bound.
[ERROR] while locating com.atlassian.maven.plugin.clover.CloverSetupMojo
[ERROR] at ClassRealm[plugin>org.openclover:clover-maven-plugin:4.2.0, parent: sun.misc.Launcher$AppClassLoader#55f96302]
[ERROR] while locating org.apache.maven.plugin.Mojo annotated with #com.google.inject.name.Named(value=org.openclover:clover-maven-plugin:4.2.0:setup)
[ERROR]
[ERROR] 1 error
[ERROR] role: org.apache.maven.plugin.Mojo
[ERROR] roleHint: org.openclover:clover-maven-plugin:4.2.0:setup
[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
Any ideas what is up here?
Thank you
Damien
From error it looks like you need higher version of Maven or older version of Clover plugin.
Going to the latest version of Maven (3.5.2) resolved this issue
I'm struggling to fix this issue since 2013...
I'm using Windows 7.
[ERROR] Failed to execute goal
org.apache.cxf:cxf-codegen-plugin:3.1.2:wsdl2java (generate-sources)
on project service-data-model-provider: Execution generate-sources of
goal org.apache.cxf:cxf-codegen-plugin:3.1.2:wsdl2java failed: Failed
to generate types.
a:\Misc\WsMock\service-data-model-provider\src\main\java\schema\eo\common\system\messageheader\v1\MessageContextType.java
(Access is denied) -> [Help 1]
Its completely random and happens for me on all cxf versions and different java versions.
At the moment I'm on jdk 1.8.45 and cxf 3.1.2
The issue can be resolved by setting always
But then the build is always successful even is some errors will happen which are shown as [Warning] in the log.. So I can't use anything like that.
Here's my cfg
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/java</sourceRoot>
<defaultOptions>
<extraargs>
<extraarg>-validate</extraarg>
<extraarg>-exsh</extraarg>
<extraarg>true</extraarg>
</extraargs>
</defaultOptions>
<wsdlRoot>..\..\..</wsdlRoot>
<includes>
<include>mds/apps/services/**/*.wsdl</include>
</includes>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
Another thing that helps but its not resolving the issue completely is to disable the WriteToCache setting in the WindowsHardDrive driver.
That indicates that the system is too slow and CXF\Java is trying to use the file before its completely written to the disk.
Using an SSD the issue is happening only occasionally.
Our data model is huge (lots of XSD's) and the hard drives are encrypted so that's why everything is so slow.
Any ideas how to tune java to handle this? Or maybe its a CXF problem?
Full Stack Trace
[ERROR] Failed to execute goal
org.apache.cxf:cxf-codegen-plugin:3.1.2:wsdl2java (generate-sources)
on project service-data-model-provider: Execution generate-sources of
goal org.apache.cxf:cxf-codegen-plugin:3.1.2:wsdl2java failed: Fai led
to generate types.
a:\Misc\WsMock\service-data-model-provider\src\main\java\co\schema\common\fault\creati
onfault\v1\ObjectFactory.java (Access is denied) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal org.apache.cxf:cxf-codegen-plugin:3.1.2:w sdl2java
(generate-sources) on project service-data-model-provider: Execution
generate-sources of goal org.apache.cx
f:cxf-codegen-plugin:3.1.2:wsdl2java failed: Failed to generate types.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
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.PluginExecutionException: Execution
generate-sources of goal org.apache.cxf:cxf-codeg
en-plugin:3.1.2:wsdl2java failed: Failed to generate types.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more Caused by: org.apache.cxf.tools.common.ToolException: Failed to generate types.
at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.generate(JAXBDataBinding.java:839)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer.java:730)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:270)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:164)
at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:415)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.generate(WSDL2JavaMojo.java:415)
at org.apache.cxf.maven_plugin.AbstractCodegenMoho.execute(AbstractCodegenMoho.java:260)
at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo.execute(WSDL2JavaMojo.java:512)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more Caused by: java.io.FileNotFoundException: a:\Misc\WsMock\service-data-model-provider\src\main\java\uk\co\schema\
common\fault\creationfault\v1\ObjectFactory.java (Access is denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:162)
at org.sonatype.plexus.build.incremental.DefaultBuildContext.newFileOutputStream(DefaultBuildContext.java:54)
at org.apache.cxf.maven_plugin.wsdl2java.WSDL2JavaMojo$1.createOutputStream(WSDL2JavaMojo.java:411)
at org.apache.cxf.tools.wsdlto.databinding.jaxb.TypesCodeWriter.openBinary(TypesCodeWriter.java:72)
at com.sun.codemodel.CodeWriter.openSource(CodeWriter.java:100)
at com.sun.codemodel.JPackage.createJavaSourceFileWriter(JPackage.java:490)
at com.sun.codemodel.JPackage.build(JPackage.java:441)
at com.sun.codemodel.JCodeModel.build(JCodeModel.java:311)
at com.sun.codemodel.JCodeModel.build(JCodeModel.java:301)
at org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.generate(JAXBDataBinding.java:827)
... 32 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/PluginExecutionException
Cheers
Prem
(Moving #Prem's comment to this answer and adding more details)
Adding <fork>always</fork> fixes the issue.
Sample configurations:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-source</id>
<phase>generate-sources</phase>
<configuration>
<fork>always</fork>
</configuration>
...
<!-- Rest of the configuration -->
Docs - maven-cxf-codegen - other config
The same had happened with me..
I too had jdk 1.8 and cxf 3.1.x
I tried the same task on a old PC with jdk 1.7 and cxf 2.7.0 and it worked like charm..
Adding the < plugin > will generate schema and service from wsdl everytime you create a build.. I don't know whether it is a efficient way or not, but I extracted the schema and service once and added them to the root.
Thanks
I faced similar kind of problem when I had problem in my wsdl file. Please check the wsdl file and any missing file path.
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 have Maven project and Tomcat server.
I work in IDEA when I click in "Maven LifeCicle" -> "deploy", i have a problem:
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) # TestMaven ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.035 s
[INFO] Finished at: 2014-09-20T13:52:32+04:00
[INFO] Final Memory: 11M/93M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project TestMaven: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [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/MojoExecutionException
Piace of my POM.xml is:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<server>tomcat</server>
<url>http://localhost:8080/manager/text</url>
</configuration>
</plugin>
Not worked or:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
also not worked.
In the default maven lifecycle mvn deploy means to deploy one or more build artifacts to a maven repository. The reason is because the maven-deploy-plugin's deploy goal is bound to the deploy phase of the lifecycle. This configuration is automatically done when you use for example packaging jar.
In maven
a maven build lifecycle is made up of phases
a phase is made up of plugin goals
the packaging type (e.g. jar, ear, war) pre-configures plugins goals for execution in a lifecycle phase
In order to solve your problem I would first package the webapp and then invoke the deploy goal of the tomcat7-maven-plugin.
mvn package org.apache.tomcat.maven:tomcat7-maven-plugin:2.0:deploy
or simply
mvn package tomcat7:deploy
The mvn command above means:
invoke the default build lifecycle until phase package
then the goal deploy of the tomcat7 plugin.
If you want to know how maven resolves tomcat7:deploy to org.apache.tomcat.maven:tomcat7-maven-plugin:2.0:deploy you should read more about plugin groups and plugin naming conventions.
With maven deploy command, usually gets errors for various reasons.
if you work in Unix/Linux system, I recommend using "rsync" method on console. (You can write own shell script to manage easily). It helps not only deploying without a problem but also helps to get time while redeploying (only uploading changed / new files). Because maven deploy / redeploy uploads your project as a bundle in jar/war. However "rysnc" method uploads your project files one by one.
Before using it, you should sure that two conditions.
1- your project is built in target folder (Spring Tool Suite)
2- you have access to tomcat via ssh
example code : (v_ : prefix which is variable(customizable))
rsync -avz v_your_project_in_target root#v_ip:v_tomcat_name/webapps/v_project_name