Search code examples
mavennetbeans

MissingProjectException by Maven in Netbeans 7.x


When I try to either Build, Clean and Build or Run (play button) my 'Maven Webapplication' in NetBeans, I get the following output:

cd E:\Dev\Apps\2012_2013\MyApp; JAVA_HOME=E:\\Apps\\Dev\\jdk7u5 "\"E:\\Apps (x86)\\Dev\\NetBeans7.0.1\\java\\maven\\bin\\mvn.bat\"" install -e
Error stacktraces are turned on.
Scanning for projects...
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 0.138s
Finished at: Mon Oct 22 13:16:36 CEST 2012
Final Memory: 2M/15M
------------------------------------------------------------------------
The goal you specified requires a project to execute but there is no POM in this directory (E:\). Please verify you invoked Maven from the correct directory. -> [Help 1]
org.apache.maven.lifecycle.MissingProjectException: The goal you specified requires a project to execute but there is no POM in this directory (E:\). Please verify you invoked Maven from the correct directory.
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:89)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    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)

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/MissingProjectException 

This is what I have tried to fix the problem:

  • Uninstalled NetBeans 7.2, removed .m2 directory, removed .nbi directory (I don't know if this belongs to NetBeans), rebooted and reinstalled NetBeans 7.2
  • Uninstalled NetBeans 7.2 and installed NetBeans 7.0.1
  • modified the POM file of the project
  • modify the context.xml file in META-INF/ folder of my project to point it to a different path.
  • Correctly install Maven by adding the proper environment variables (works for mvn --version in cmdline but still error in NetBeans)

My projects used to build and run perfectly with no problems when I was using NetBeans 7.0.1, until I installed NetBeans 7.2. That's when I started getting this error. I do have a POM file in my project. The error doesn't go away no matter what I try.

Other strange behavior:

  • When I try to create a new Maven Webapplication in NetBeans, it always creates it under the root of my drive E:\ in a folder even though I explicitly tell it to install it under my projects folder.

What works:

  • The only time when my projects successfully build and run is when I run them in my Windows XP SP3 virtual machine. So I don't know what to think here. What application or configuration is at fault? I find it very difficult to troubleshoot.

  • Running this command: https://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException thus using an explicit path to my project. I don't want to do this every time. I want it to work like it's supposed to.

Specs:

  • JDK 1.7
  • Sourcecode java
  • version: 1.6
  • OS: Windows 7 x64
  • Server used: Tomcat 7.x

Solution

  • I had the same problem when I set command promp default directory in the windows register to E:\ according: http://www.sevenforums.com/customization/77997-change-command-prompt-default-directory.html

    After I deleted this regkey netbeans worked right for me.