简体   繁体   中英

Deploy goal fails in Netbeans

I'm facing a rather weird issue in Netbeans at the moment. When attempting to deploy a maven project to an external repository in Netbeans I get a:

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin...... Return code is: 401, ReasonPhrase: Unauthorized.

I've set up a maven project in netbeans and added a custom build goal to deploy (using mvn deploy ). All works well until the deploy stage where the actual deploy is failing. The repository I use has a username/password combination required which has been defined in my settings.xml file for Maven and deploying using the command line works without issue (ie I open command prompt and type mvn deploy in the project directory and I get a build success).

After some experimenting I determined that when netbeans calls maven for building, the settings.xml file is somehow not being read. I've tried putting the settings file in my user.home\\.m2\\ directory as well without success. Am I missing something or is this just a bug with netbeans?

Netbeans is running:

mvn -Dmaven.ext.class.path=\\"<path to netbeans>\\\\java\\\\maven-nblib\\\\netbeans-eventspy.jar\\" deploy

and everything works until the deploy stage.

Edit:

I've tried switching from the bunched maven that netbeans provides to my personal installation with no avail.

I am running Windows 7 x84-64.

which settings.xml file are we talking about? there's one called "user" settings file placed in ~/.m2/ and then there's another one that is called "global" I think which resides in $M2_HOME/conf/ and is part of the installation. If netbeans is not picking up your global settings file, then it's likely because it's using a different maven installation than your command line (by default netbeans uses it's own copy).

Try setting your usual maven installation as the one to be used by netbeans (Tools/Options -> Java/Maven or similar based on the version you are using)

copying you settings.xml to ~/.m2/settings.xml should have worked as well, I suppose you've done something wrong, or netbeans is pointed at different java.lang.System.getProperty("user.home")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM