使用 maven 部署项目到私服 nexus 出现 Deployment failed 问题的解决方法
2017-05-11 18:03
956 查看
1 问题描述
一个新的工具类项目,希望部署到私服供其他项目使用。使用 maven 的 deploy 命令后,出现这个问题:[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project deniro-tools: Deployment failed:repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1]
2 分析
repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
很明显,在项目的 pom.xml 文件没有指定需要部署的私服信息!
3 解决
在 pom.xml 中新增要部署的私服信息:<!-- 部署到 nexus 服务器--> <distributionManagement> <repository> <id>128</id> <name>New Nexus Repository Releases</name> <url>http://xxx/nexus/content/repositories/releases/</url> </repository> </distributionManagement>
在 maven 的 setting.xml 中添加服务器的账号信息,配置好后, maven 才能正常访问我们的私服,把这个项目打包上传上去:
<server> <id>128</id> <username>xxx</username> <password>xxx</password> </server>
注意:这里的 ID 必须与 pom.xml 中的 repository 的 id 一致,这样才能一一对应哦。O(∩_∩)O~
4 验证
重新运行 maven 的 deploy 命令,运行成功:[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.959 s [INFO] Finished at: 2017-05-11T17:49:28+08:00 [INFO] Final Memory: 14M/280M [INFO] ------------------------------------------------------------------------
相关文章推荐
- jfinal下部署maven项目遇到的问题及解决方法
- 解决使用maven的java web项目导入或新建添加pom配置后出现的有关问题 -cannot be read or is not a valid ZIP file
- 在安装有VS2008beta2版本的机子上使用vs2005进行部署出现问题的解决方法
- 在windows上部署使用Redis出现问题的解决方法
- 项目部署到远程服务器出现Unsupported major.minor version 51.0问题及解决方法
- 解决使用maven的java web项目导入后出现的有关问题, -cannot be read or is not a valid zip file
- 不使用IDE,用maven命令打包war项目及出现的问题解决(最全攻略,亲测有效)
- 使用tomcatPlugin配合JRebel解决maven项目依赖war的打包和热部署的问题
- maven项目出现Xxx is not a Servlet的问题解决方法
- 关于tomcat部署项目出现的问题并解决方法
- 不使用IDE,用maven命令打包war项目及出现的问题解决(最全攻略,亲测有效)
- 使用MyEclipse创建Maven项目出现的错误及解决方法
- 解决使用maven的java web项目导入后出现的有关问题 -cannot be read or is not a valid ZIP file
- 在windows上部署使用Redis出现问题的解决方法
- 集成jcaptcha到spring-boot+maven项目中时出现java.lang.NoSuchMethodError: com.jhlabs.image.WaterFilter的问题的解决方法
- 使用crontab 出现Unsupported major.minor version 51.0问题的解决方法
- mac 使用MyEclipse时遇到无法创建web项目问题解决方法
- encodeURI与encodeURIComponent方法的区别 如果你使用的get方法提交表单肯定要考虑到输入项目的编码解码问题。 解决这个问题大家一般都使用encodeURI或者en
- Win8/8.1系统metro应用中使用IE浏览器出现闪退问题的解决方法