Building Eclipse IDE from scratch - how to specify the target OS? - java

This post is about building the whole Eclipse IDE from the source code - and more in particular how to specify the target OS you want to build the executable for.
I found the following tutorial to guide me through the build procedure: http://www.vogella.com/tutorials/EclipsePlatformDevelopment/article.html
Especially chapter 13 of that Tutorial is helpful. I will describe the steps that need to be taken one by one here - so you don't need to read the vogella tutorial.
NEEDED SOFTWARE :
Apparently you need to have the following software installed on your (Windows) machine:
Git
Maven Version 3.3.1 (make sure that the bin folder where you extract Maven is added to the PATH. For installation instructions see https://maven.apache.org/install.html)
Oracle 1.8 JDK or higher (don't forget to set the JAVA_HOME environment variable)
Now you're ready to start:
STEP 1 :
Create a new folder in the C:\ disk. Let's name it C:\myEclipse. This will be the folder in which we pull the Git repository of the latest Eclipse version.
STEP 2 :
Open the Windows cmd shell with administrator privileges (right click on cmd icon if you made one on your desktop, and select open with admin rights). Go to that folder through the command cd C:\myEclipse. Now type the following command: git config --system core.longpaths true. This notifies Git that long names can occur in the repository. Forget this command and it will result in errors later on.
STEP 3 :
Clone the Git repository:
git clone -b master --recursive git://git.eclipse.org/gitroot/platform/eclipse.platform.releng.aggregator.git
Now you should have some patience for all the sourcecode to get copied to your local folder.
STEP 4 :
Finally it is time to start the build. The build procedure will already take hours, so it is wise to skip the unit tests. Therefore do not forget to add the -DskipTests parameter. This is the command to start the build:
mvn clean verify -DskipTests
After some hours, the build should be finished.
STEP 5 :
The results of the build should now be in the following folder:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.releng.tychoeclipsebuilder\sdk\target\products
Notice that the Eclipse IDE is built for all possible target machines. 32-bit Windows, 64-bit Windows, Macintosh, Linux, ... No wonder it takes hours! I would like to build for just one single target - for example my 64-bit Windows machine. This will hopefully reduce the build time significantly and allow me to verify code changes quicker.
Does anyone know how to achieve this?
EDIT :
I have added the argument -Dnative=win32.win32.x86_64 to the build command. Unfortunately, I get an error after 15 to 20 mins. This time, I've added the argument -X as well, to get debug information:
...
[INFO] equinox-sdk ........................................ SKIPPED
[INFO] org.eclipse.rcp.id ................................. SKIPPED
[INFO] org.eclipse.rcp.sdk.id ............................. SKIPPED
[INFO] org.eclipse.platform.ide ........................... SKIPPED
[INFO] org.eclipse.platform.sdk ........................... SKIPPED
[INFO] org.eclipse.sdk.ide ................................ SKIPPED
[INFO] eclipse-junit-tests ................................ SKIPPED
[INFO] eclipse.platform.repository ........................ SKIPPED
[INFO] platform-aggregator ................................ SKIPPED
[INFO] -----------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] -----------------------------------------------------------------------
[INFO] Total time: 23:54 min
[INFO] Finished at: 2016-06-19T18:12:14+02:00
[INFO] Final Memory: 668M/3263M
[INFO] -----------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8: run (natives) on project org.eclipse.swt.win32.win32.x86_64: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:915: The following error occurred while executing this line:
[ERROR] C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:1012: exec returned: 1
[ERROR] around Ant part ...<ant antfile="build.xml" target="build_libraries"/>... # 4:54 in C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt.binaries\bundles\org.eclipse.swt.win32.win32.x86_64\target\antrun\build-main.xml
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:
run (natives) on project org.eclipse.swt.win32.win32.x86_64:
An Ant BuildException has occured:
The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:915: The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:1012: exec returned: 1 around Ant part ...<ant antfile="build.xml" target="build_libraries"/>... # 4:54 in C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt.binaries\bundles\org.eclipse.swt.win32.win32.x86_64\target\antrun\build-main.xml
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:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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:
An Ant BuildException has occured:
The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:915:
The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:1012: exec returned: 1 around Ant part ...<ant antfile="build.xml" target="build_libraries"/>... # 4:54 in C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt.binaries\bundles\org.eclipse.swt.win32.win32.x86_64\target\antrun\build-main.xml
at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:342)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default BuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt.binaries\bundles\org.eclipse.swt.win32.win32.x86_64\target\antrun\build-main.xml
:4: The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml
:915:The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:1012: exec returned: 1
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:568)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:443)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:313)
... 22 more
Caused by: C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml
:915: The following error occurred while executing this line:
C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:1012: exec returned: 1
at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:568)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:443)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
... 33 more
Caused by: C:\myEclipse\eclipse.platform.releng.aggregator\eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml:1012: exec returned: 1
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:643)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:669)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:495)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor67.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:441)
... 46 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 :org.eclipse.swt.win32.win32.x86_64
I still have no answer, so I started a bounty. Please reproduce step 1 until step 5 on your machine (with the -Dnative=win32.win32.x86_64 argument added to the fourth step). Do you achieve a successful build of the Eclipse IDE for just one OS target (preferably Windows 64-bit)? Does the build go faster - compared to the general build process that targets all OS's?
PS: I've got some other questions related to the Eclipse "Build from scratch" topic. If you're interested:
Building Eclipse IDE from scratch - how to choose CDT over JDT?
Building Eclipse IDE from scratch - how to specify the target OS?
Building Eclipse IDE from scratch - making bigger icons sometimes successful
Let us all unite to build the Eclipse IDE ourselves - and tweak it to our needs ;-)
EDIT :
Mr/Mss. Zapl wrote an interesting comment. He/She thinks that the -Dnative argument is not correct, after he/she read the following link:
http://comments.gmane.org/gmane.comp.ide.eclipse.cbi.devel/896
Hopefully we'll get closer to the answer now :-)
FINAL EDIT :
Suddenly this question catched the attention of the community. I got a lot of suggestions/answers in a short time. I cannot verify every single one of them right now because the build procedure takes about 2 hours.
I have 19 hours left to award the 50 points bounty. Please let me know if you successfully reproduced the STEPS 1..5 from this question on your own machine, and succeeded to build the Eclipse IDE from scratch for one specific OS. I will award you the bonus :-)

This snippet is taken from a working pom.xml that exports to win32.win32.x86_64.
Maybe some parts are not required for your project but it may be a good starting point to add this to your pom file.
..
..
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>0.20.0</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>0.20.0</version>
<configuration>
<resolver>p2</resolver>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>0.20.0</version>
<configuration>
<compilerArgument>-err:-forbidden</compilerArgument>
</configuration>
</plugin>
</plugins>
</build>
..
..
EDIT
As mentioned in the comments I followed your steps and had some problems. I solved most of them now. If someone else also gets a lot of errors here are some solutions.
In the file eclipse.pde.ui/pom.xml line 19: the version was 4.6.0-SNAPSHOT, but has to be 4.7.0-SNAPSHOT
Hint: To speed up the build you can add e.g. "-T 4" to the mvn command to enable parallel builds. I finally ended with >mvn clean verify -DSkipTests -T 4 -Dnative=win32.win32.x86_64
After this fix I was able to run until I got the same errors mentioned in the initial question.
I went to the project folder \eclipse.platform.swt.binaries\bundles\org.eclipse.swt.win32.win32.x86_64 and started an Ant build (Apache Ant version 1.9.7) and it finished without errors. But I got the same errors when it was executed by the Maven build.
Thus, I checked lines 915 and 1012 of the file \eclipse.platform.swt\bundles\org.eclipse.swt\buildSWT.xml. After setting failonerror="false" (is set to "true" by default) in both lines I was able to continue with the build. I assess this as a very poor solution and it should not be the final solution for a problem to disable such tests.
Finally, I ended with errors in project org.eclipse.pde.build.tests and stopped following the problems.
The whole project seems to be misconfigured in many parts and I could not find a better solution so far. People should remember the golden rule not to commit anything that breaks the build to avoid such problems. Maybe the problems will be solved after a few updates to the repo.

There are multiple projects that are built here
SWT natives. (-Dnative=)
IDE. (platform independent)
SWT natives are built(by SWT team) every day at 19:00 EST/EDT everyday and pushed to eclipse.platform.swt.binaries.git repo. This build requires a quite a bit of dependencies like visual studio, xulrunner, WebKit, etc. For trying out a build I don't suggest you to attempt this .
CBI(Common Build Infrastructure) does the eclipse plugin builds and signing and packaging. This process is platform independent.
CBI build starts at 20:00 EST/EDT daily and the swt.binaries are picked up only during packaging. The packaging would probably takes about 5 minutes in the whole process. So I am not expecting much difference if you specify only 1 target to build.

To targeting just one single OS you have to specify the target environment in the parent pom.xml file (see Tycho - Target runtime environment):
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environments>
</configuration>
</plugin>
If you use PDE Build instead of Maven/Tycho the Ant property is configs, e.g, -Dconfigs="win32, win32, x86".
FYI: Eclipse Platform CI which generates the Eclipse SDK archives

From https://wiki.eclipse.org/Platform-releng/Platform_Build#Building_natives
Optionally, you can pass -Dnative= parameter with one of the following options to compile the natives for the specified native.
cocoa.macosx.x86
cocoa.macosx.x86_64
gtk.linux.x86
gtk.linux.x86_64
win32.win32.x86
win32.win32.x86_64
win32.wce_ppc.arm
The arg would be -Dnative=win32.win32.x86_64

Related

Eclipse Maven Build/Plugin Issue

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.

Unable to load the mojo 'test' - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test

I am building my apps with Maven-3 and i guess after auto-refresh of maven-surefire-plugin to 3.0.0-M1 i am not able to do build and getting the below error.
As a initial step, I have cleared the directory /org/apache/maven in my repository however still i am facing the issue. Can anyone advise. Note - if i am downgrading the surefire plugin to 2.x then I am able to build it.
Error log
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.444s
[INFO] Finished at: Thu Nov 08 16:04:53 GMT 2018
[INFO] Final Memory: 60M/704M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test) on project TEST_PROJECT: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test failed: Unable to load the mojo 'test' (or one of its required components) from the plugin 'org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1': com.google.inject.ProvisionException: Guice provision errors:
[ERROR]
[ERROR] 1) No implementation for org.codehaus.plexus.languages.java.jpms.LocationManager was bound.
[ERROR] while locating org.apache.maven.plugin.surefire.SurefirePlugin
[ERROR] at ClassRealm[plugin>org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1, parent: sun.misc.Launcher$AppClassLoader#5c647e05]
[ERROR] while locating org.apache.maven.plugin.Mojo annotated with #com.google.inject.name.Named(value=org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test)
[ERROR]
[ERROR] 1 error
[ERROR] role: org.apache.maven.plugin.Mojo
[ERROR] roleHint: org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test) on project TEST_PROJECT: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test failed: Unable to load the mojo 'test' (or one of its required components) from the plugin 'org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1'
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test failed: Unable to load the mojo 'test' (or one of its required components) from the plugin 'org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1'
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.apache.maven.plugin.PluginContainerException: Unable to load the mojo 'test' (or one of its required components) from the plugin 'org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1'
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:488)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
... 20 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupException: com.google.inject.ProvisionException: Guice provision errors:
1) No implementation for org.codehaus.plexus.languages.java.jpms.LocationManager was bound.
while locating org.apache.maven.plugin.surefire.SurefirePlugin
at ClassRealm[plugin>org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1, parent: sun.misc.Launcher$AppClassLoader#5c647e05]
while locating org.apache.maven.plugin.Mojo annotated with #com.google.inject.name.Named(value=org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test)
1 error
role: org.apache.maven.plugin.Mojo
roleHint: org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:257)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:245)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:455)
... 21 more
Caused by: com.google.inject.ProvisionException: Guice provision errors:
1) No implementation for org.codehaus.plexus.languages.java.jpms.LocationManager was bound.
while locating org.apache.maven.plugin.surefire.SurefirePlugin
at ClassRealm[plugin>org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1, parent: sun.misc.Launcher$AppClassLoader#5c647e05]
while locating org.apache.maven.plugin.Mojo annotated with #com.google.inject.name.Named(value=org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test)
1 error
at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:974)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:83)
at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:49)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:253)
... 23 more
You can upgrade your maven version to 3.6.0 latest to solve this issue. This can be compatible from 3.3.9 maven version.
Looking at the comments on upgrading maven version, we updated our maven version and was able to overcome the surefire plugin issue using maven 3.3.9. Didn't get any issues.
I found that my NetBeans was using a very old maven (3.0.5) even though I had a brand new maven installed.
On my Mac, I had to go to the menu "Netbeans/Preferences", select the "Maven" tab, and change from "Bundled", browsed to latest, and this got rid of the error above for me.
I had this problem until I discovered that we were not explicitly specifying the version of the surefire plugin. Once I changed our pom.xml file to set the version, it worked.
You can downgrade the version of maven-surefire-plugin to 2.12.4 using the pluginManagement tag. It worked for me.
If you are facing the issue in netbeans IDE you need to change default mavenhome version.follow the below steps
in menu bar tools->Options->click java tab --> under categories --> Execution --> Maven home drop down select manually installed location of the maven
I agree with SomMS's answer
But as an FYI, I found this thread, immediately dismissed that maven version could be the problem the as I just (last week) built this RHEL VM and it was new and shiny
... 15 minutes later I decided to check the maven version to find it was v3.0.5!
Hopefully the next guy doesn't make the same mistake
And if you are wondering how to get the version of whats installed try
mvn --version
I used #SomMS's suggestion and upgraded Maven in order to fix the issue. It worked.
The problem is that, at the time of this writing, the latest version of Maven available on CentOS 7 is 3.0.5 (default repository), which is really old (Feburary 2013). Most other distros have way newer Maven versions available to them.
My only solution was to do a manual download and add path to its binary in PATH env-variable. Downside here is that now rpm/yum are not aware of its existence.

Building Maven project on PPC64

I am trying to build a maven project on a ppc64-64 architecture. The project builds just fine on my local workstation (which is a x86_64 architecture). It throws the following error when I try to build:
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project Client: ExecutionException: java.lang.LinkageError: org.apache.maven.surefire.booter.PropertiesWrapper -> [Help 1] org.apache.maven.lifecycle.LifecycleExecution: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project Client: ExecutionException.
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.LifecycleModuleRBuilder.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:94)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:619)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: ExecutionException
at org.apache.maven.plugin.surefire.SurefirePlugin.assertNoException(SurefirePlugin.java:203)
at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:193)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:861)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:729)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: ExecutionException
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkPerTestSet(ForkStarter.java:316)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:169)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:967)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:831)
... 22 more
Caused by: java.util.concurrent.ExecutionExeception: java.lang.LinkageError: org.apache.maven.surefire.shade.org.apache.maven.shared.utils.Os
at java.util.concurrent.FutureTask.report(FutureTask.java:133)
at java.util.concurrent.FutureTask.get(FutureTask.java:199)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkPerTestSet(ForkStarter.java:300)
… 25 more
Caused by: java.lang.LinkageError: org.apache.maven.surefire.shade.org.apache.maven.shared.utils.Os
at java.lang.Classloader.defineClassImpl(Native Method)
at java.lang.Classloader.defineClass(ClassLoader.java:364)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:777)
at java.net.URLClassLoader.access$400(URLClassLoader.java:96)
at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1225)
at java.security.AccessController.doPrivileged(AccessController.java:366)
at java.net.URLClassLoader.findClass(URLClassLoader.java:660)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:389)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:259)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:235)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:227)
at org.apache.maven.surefire.shade.org.apache.maven.shared.utils.cli.Commandline.setDefaultShell(Commandline.java:131)
at org.apache.maven.surefire.shade.org.apache.maven.shared.utils.cli.Commandline.<init>(Commandline.java:121)
at org.apache.maven.plugin.surefire.booterclient.ForkConfiguration.createCommandLine(ForkConfiguration.java:148)
at org.apache.maven.plugin.surefire.booterclient.ForkConfiguration.createCommandLine(ForkConfiguration.java:137)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:406)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:352)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.access$300(ForkStarter.java:85)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter$2.call(ForkStarter.java:288)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter$2.call(ForkStarter.java:283)
at java.util.concurrent.FutureTask.run(FutureTask.java:273)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1170)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:640)
at java.lang.Thread.run(Thread.java:853)
After the error message it says that I should read the MojoFailureExeception wiki (which I did). It said that I should read the documentation of surefire (which I did). I didn't see anything that was helpful.
If I try to build the project without tests, it compiles fine.
The bottom line is that I have never done anything like this before and I am not even sure it is possible to take a Maven Java project that was build for x86 and have it compile and run on a PPC64 architecture. Any tips or pointers anyone could give would be greatly appreciated.
What is the motivation to build maven for ppc64 if this package is already made available by other the distro?
I just checked on my Ubuntu 14.10 for Power
brenohl#sid:~$ cat /proc/cpuinfo | grep model
model : 8247-22L
brenohl#sid:~$ apt-cache search maven | grep ^maven
maven-ant-helper - helper scripts for building Maven components with ant
maven-repo-helper - Helper tools for including Maven metadata in Debian packages
maven - Java software project management and comprehension tool
maven-debian-helper - Helper tools for building Debian packages with Maven
maven2 - Java software project management and comprehension tool
It also shows that maven2 is architecture independent on Debian and Ubuntu, so, the package is the same for any architecture, so, no compiling is required:
brenohl#sid:~$ apt-cache show maven2 | grep ^Architecture
Architecture: all
Take a look at section 5.4.8 at Debian Policy

Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C:\Program Files\Java\jre7

I am new to maven and i have been creating simple web application with maven using hibernate, spring etc. i get following error occur when i run mvn eclipse:eclipse command.
[WARNING] Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C:\Program Files\Java\jre7
[WARNING] could not read workspace project:c:\Users\Acer\workspace\.metadata\.plugins\org.eclipse.core.resources\.projects\myproject
org.codehaus.plexus.util.xml.pull.XmlPullParserException: processing instruction can not have PITarget with reserveld xml name (position: START_D
OCUMENT seen \r\n<?xml ... #2:7)
at org.codehaus.plexus.util.xml.pull.MXParser.parsePI(MXParser.java:2453)
at org.codehaus.plexus.util.xml.pull.MXParser.parseProlog(MXParser.java:1447)
at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl(MXParser.java:1395)
at org.codehaus.plexus.util.xml.pull.MXParser.next(MXParser.java:1093)
at org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:187)
at org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:83)
at org.codehaus.plexus.util.xml.Xpp3DomBuilder.build(Xpp3DomBuilder.java:48)
at org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.readArtefact(ReadWorkspaceLocations.java:341)
at org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.readWorkspace(ReadWorkspaceLocations.java:536)
at org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations.init(ReadWorkspaceLocations.java:94)
at org.apache.maven.plugin.eclipse.EclipsePlugin.getWorkspaceConfiguration(EclipsePlugin.java:2063)
at org.apache.maven.plugin.eclipse.EclipsePlugin.fillDefaultClasspathContainers(EclipsePlugin.java:1580)
at org.apache.maven.plugin.eclipse.EclipsePlugin.setup(EclipsePlugin.java:978)
at org.apache.maven.plugin.ide.AbstractIdeSupportMojo.execute(AbstractIdeSupportMojo.java:500)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
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)
[INFO] no substring wtp server match.
this is my pom.xml
could anybody tell me what i am doing wrong here. thanks in advance for any help
I was also getting the error:
[WARNING] Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C:\Program Files\Java\jre6
but I don't get the
[WARNING] could not read workspace project:c:\Users\Acer\workspace.metadata.plugins\org.eclipse.core.resources.projects\myproject
(perhaps you were not setting your workspace path up correctly on the mvn command line by using the option -Declipse.workspace=...)
Anyway, the first warning was caused by me using a JDK in a non-standard place (JAVA_HOME=C:\tools\java\jdk1.6.0_31) and setting my Eclipse workspace up to use that as the default. The Maven Eclipse plugin does not seem to choose the default JDK correctly, The "mvn eclipse:eclipse" would not work until I removed the JDK in "C:\Program Files\Java\jre6" from the list of installed JDKs within Eclipse. I only have the correct one in the list now.
I looks like a java issue. Check your java_home directory. Is it pointing to C:\Program Files\Java\jre7 ? If so let maven also point to read same location by configure the toolchains.xml in your maven directory (e.g D:\maven-2.2.1\conf) to your java version
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>1.7</version> <!--This should be same as is configured via the toolchains plugin -->
<vendor>ibm</vendor> <!--This should be same as is configured via the toolchains plugin -->
</provides>
<configuration>
<jdkHome>C:\Program Files\Java\jdk1.7.0</jdkHome>
</configuration>
</toolchain>
</toolchains>
Add your own JRE, remove the default JRE installed in Eclipse. Yeah, it works.I could get no warning information when typing the command mvn eclipse:eclipse.
Try to store your maven projects in a directory that is not your eclipse workspace then import the projects to eclipse (without copying it!). Now the mvn eclipse:eclipse should work without warnings.
Seems to me maven fails to parse Eclipse's workspace settings properly. I was hitting the warning, and then I removed all JREs (I had two JREs and one JDK under Window-Preferences-Java-Installed JREs) and left only the JDK. No warnings since.
I am using Java 8, and I found that every time I did the eclipse:eclipse it was changing the JRE to JavaSE-1.7 instead of the JavaSE-1.8.
After more review of a bare bones pom.xml I saw the line in my properties section for maven.compiler.source and maven.compiler.target pointing to 1.7. Once I changed that to 1.8 everything works as expected.
I also have multiple version of Java setup. That didn't seem to be a problem. Updating this line seemed to do the trick, no more warnings when I do eclipse:eclipse now.
Hope it helps.

maven-exec-plugin throws exception for no apparent reason

I type the following in a Windows shell in the root of a Maven project that contains a class with a
public static void main(String[] args)
method that I'd like to run.
mvn exec:java -Dexec.mainClass="com.spp.config.main.SqlGeneratorHarness" -e
The class exists and is compiled in that package
(i.e., target/classes/com/spp/config/main/SqlGeneratorHarness.class).
I see...
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'exec'.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Invalid task '.mainClass=com.spp.config.main.SqlGeneratorHarness': you must specify a valid
lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal
[INFO] ------------------------------------------------------------------------
[INFO] Trace org.apache.maven.BuildFailureException: Invalid task' .mainClass=com.spp.config.main.SqlGeneratorHarness': you must specify
a valid lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1830)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:462)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:175)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
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.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Tue Sep 27 14:33:52 PDT 2011
[INFO] Final Memory: 3M/122M
[INFO] ------------------------------------------------------------------------
I've tried variations like
mvn exec:exec -Dexec.executable="java" [...]
and
mvn org.codehaus.mojo:exec-maven-plugin:1.2.1:java [...]
to no avail. What gives?
I'm running Maven 2.2.1, Java JDK 1.6.0_27 on Windows 7 Enterprise 64-bit.
A snippet from my pom.xml for the exec-maven-plugin is...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
</plugin>
where the version is set in the <properties>
So... revisiting this... if you use Windows PowerShell, you will get the exception I originally reported. If, however, you use cmd.exe, then you should be able to run the class with the command as I posted (with or without wrapping double-quotes).
There's something very basic going wrong. Try losing the quotation marks. They're not needed there. In fact, try starting with something simpler, like
mvn -e exec:java -Dexec.mainClass=foo
That should give you the error "An exception occured while executing the Java class. foo", and the root cause should be a ClassNotFoundException:
Caused by: java.lang.ClassNotFoundException: foo
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
Type it out yourself. Don't copy/paste the command from somewhere else.
Just a quick checklist:
Rename ~/.m2 folder and run mvn exec:java ... again and let Maven to download everything again from central.
Check that your exec plugin is downloaded from central. (Check that your local repository contains the same files as the central.)
Looking for suspicious repository and pluginRepository tags in the pom.xml (and parent poms as well).
Looking for suspicious repository, pluginRepository and mirror tags in the settings.xml.
Checking the project in an other machine - copy it and try to build/run exec:java in an other machine.
Download Maven 3.x and try to run the exec with it.

Categories

Resources