Skip to content

Importing Maven Java Project in Different IDEs

Ilias Koukovinis edited this page Jul 3, 2025 · 1 revision

Eclipse

  1. Go to FileImportMavenExisting Maven Projects.
  2. Browse to the repository folder.
  3. Click Select All.
  4. Click Finish.

IntelliJ IDEA

  1. Open IntelliJ IDEA.
  2. Choose Open from the welcome screen or go to FileOpen.
  3. Navigate to the repository folder (where the pom.xml is located).
  4. Click OK (IntelliJ will automatically detect it's a Maven project and import it).

VS Code (with Java & Maven extensions)

  1. Open VS Code.
  2. Install Extension Pack for Java.
  3. Use FileOpen Folder to open the repository folder.
  4. If prompted, click Yes to import Maven projects.

NetBeans

  1. Go to FileOpen Project.
  2. Browse to the repository folder.
  3. Select the project (NetBeans detects Maven projects automatically).
  4. Click Open Project.

Note

Note: running any of the Maven projects in NetBeans may fail with an error akin to this:

Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
   at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:1000)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:947)
    at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:471)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:104)
    at java.lang.reflect.Method.invoke (Method.java:565)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time:  1.009 s
Finished at: 2025-07-03T23:43:31+03:00
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:exec (default-cli) on project ermis.server: Command execution failed.: > Process exited with an error: 1 (Exit value: 1) -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

That is attributed to the fact that, by default, NetBeans executes mvn exec:exec in order to run a Maven project. I have yet to trace the source/root of this issue, and I have no motivation to do so — since mvn exec:java works fine — as well. I am certain there is a workaround and that you can configure NetBeans to use mvn exec:java instead of mvn exec:exec. Then again though, I am not an avid fan of NetBeans and I am not aware of such fix.

Clone this wiki locally