Maven和Jenkins-' mvn'不被识别为内部或外部命令, [英] Maven and Jenkins - 'mvn' is not recognized as an internal or external command,

查看:51
本文介绍了Maven和Jenkins-' mvn'不被识别为内部或外部命令,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习詹金斯和Maven.

I am trying to learn Jenkins and Maven.

到目前为止,我做了什么:

So Far what i have done:

  1. 安装了Maven并将M2M2_HOME设置为环境变量
  2. 从eclipse创建了一个简单的maven项目. ->创建了一个.bat文件,我正在其中移动到pom.xml文件所在的目录并运行mvn clean package.我运行这个蝙蝠文件.
  1. Installed Maven and set M2 and M2_HOME as env variables
  2. Created a simple maven project from eclipse. --> Created a .bat file in which I am moving to the directory where the pom.xml file is located and running mvn clean package. I run this bat file.

一切都按预期进行到了这里.

Everything went as expected till here.

  1. 现在,我安装了jenkins并创建了一个项目(或作业)>添加了构建步骤,作为"Execute Windows batch command".并输入了蝙蝠的位置.

但是我遇到以下错误:

*Started by user anonymous*
*Building in workspace C:\Users\abhi\ .jenkins\jobs\Maven\workspace*
*[workspace] $ cmd /c call C:\WINDOWS\TEMP\hudson6018913903543004539.bat*

*C:\Users\abhi\ .jenkins\jobs\Maven\workspace>C:\Users\abhi\Desktop\ma.bat*

*C:\Users\abhi\ .jenkins\jobs\Maven\workspace>E:*

*E:\>cd AllStuffLearning\EclipseWorkSpaces\MavenWorkSpace\MyMavenPrj\ *

*E:\AllStuffLearning\EclipseWorkSpaces\MavenWorkSpace\MyMavenPrj>chdir*
*E:\AllStuffLearning\EclipseWorkSpaces\MavenWorkSpace\MyMavenPrj*

*E:\AllStuffLearning\EclipseWorkSpaces\MavenWorkSpace\MyMavenPrj>mvn clean* *package *
*'mvn' is not recognized as an internal or external command,*
*operable program or batch file.*
*Build step 'Execute Windows batch command' marked build as failure*
*Finished: FAILURE*

推荐答案

适当的方法是通过系统配置来定义此类工具的位置.管理Jenkins和系统配置,您就可以像这样:.不需要定义属性等.如果您对Maven..than等不同版本执行此操作,则可以在工作中选择不同的版本,如下所示:

The appropriate way is to define the location of such tools via the system configuration. Manage Jenkins and System Configuration and there you can do it like this:. Than there is no need to define properties etc. If you do this for different versions for example for Maven..than you can select the different version in your job like this:

这篇关于Maven和Jenkins-' mvn'不被识别为内部或外部命令,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆