I am desperate to solve this problem because it's crucial to solve it and I've been trying to fix it for a week.
When I try to either Build, Clean and Build or Run (play button) my 'Maven Webapplication' in NetBeans, I get the following output:
This is what I have tried to fix the problem:
- Googled about 30 threads on this exact subject and tried their solutions to no avail
- 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)
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.
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.
-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.
This is a NetBean problem, not a Maven problem. I assume that if you opened a command prompt, cd'ed to your project's folder and ran 'mvn install' that it would work, correct? Thus the issue is that NetBeans seems to be screwing things up (typical for most IDEs).
I would try digging through the project configuration information in NetBeans (right-click the project and select Properties), and also through the global config settings (Tools > Options) - something somewhere is telling NetBeans to use 'e:/' instead of the project's base directory. (By the way, when you reinstalled Netbeans, did you let it re-read your old configuration? If so, you might want to try an reinstall again but this time wipe out the configuration settings.)
Meanwhile. I'll move this post to the proper forum where you can get NetBeans help.
I tried looking everywhere in Tools->Options and in the project's properties and POM file to no avail. It continues to generate this error and it continues to create new projects in C: for some reason unknown to me. Someone wrote to me:
"I had the same problem, I got a new working station (with Windows 8 64bit). I tried to build my EJB and got the same exception you did.
I knew my projects dir was in the My Documents dir, I also knew that this dir was actually redirected to the server. This seemed to be the problem I have my projects somewhere local now and everything builds OK."
I tried this as well. My projects are already local (though the last project I created was pulled from a public svn:// server of my university).
I also tried running Maven with the -f parameter from commandline. That worked, but that doesn't fix my problem. Here's the output:
The strange thing is that NetBeans 7.2 keeps creating my Maven Webapplications in C:\, regardless of where I tell it to create my project. It ignores my specified project path.
When I create a regular Java application however, NetBeans creates it in the location specified and I get no problems with it.
So why is it only creating Maven Webapplications in a folder directly under C:\?
Could this have anything to do with the Archetype plugin?
Search for folders named NetBeans in your user profile folder. The name of that folder is in the USERPROFILE variable, if you're unsure where it is located on you computer, type SET on command promt (it will display all environment variables, the USERPROFILE will be towards the end of the list). NetBeans configuration is stored in that folder.
On my Windows 7 computer, it is located in C:\Users\<username>\AppData\Roaming\NetBeans. This folder contains subfolders for various versions of NetBeans. Quit NetBeans, move the subfolder (in my case, it is 7.2.1) elsewhere (so that you have a backup) and restart NetBeans -- they'll rebuild the configuration. If there are configurations for older versions, NetBeans will probably offer to import older settings, if you really want brand fresh configuration, don't import the old settings.
Note: older versions have put the folder to slightly different locations, eg. C:\Users\<username>\.netbeans\7.0. Search for all folders containing "netbeans" to make sure you've found the correct folder.
Sorry, I'm completely out of ideas. Something is seriously screwed up on your system, but I can't think of what, especially since you deleted the NetBean configuration directory.
But as a last shot, you could try uninstalling NetBeans, then delete these directories in your home directory: .nbi, .nbprofiler, .netbeans, .netbeans-derby (and anything else with 'nb' or 'netbeans' in it), then delete the NetBean directory in one of the Program Files directories. Then move your NetBeans project directory (zip it up, backup it up, and then remove it). The idea is to not leave around anything that might be picked up later.
Reboot (probably not necessary, but do it anyway). Then reinstall NetBeans. Create a new Maven project and see if it behaves now. If it does, create a new project with the same options as your old project, then using Explorer copy only the source files from your backed up project to your new project. Hopefully, this will fix the issue.
Just an aside: The above process is a heck of a lot easier with Eclipse - since Eclipse uses "xcopy installation" you can install Eclipse in numerous locations (I usually have two or three copies installed) and use each to edit numerous workspaces. Each installation maintains its own copy of its settings within it installation directory, or in the workspace directory. Often fixing an issue is as simple as downloading and unzipping a new copy of Eclipse and creating a new workspace (no need to uninstall anything). I really dislike Netbeans requirement to install using the Windows installer, and then its use of the home directory to store config info; this prevents me from installing multiple copies of NetBeans like I can with Eclipse.