Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
344 views
in Technique[技术] by (71.8m points)

azure - Unable to copy warfile from agent folder to Tomcat folder in AzureDevops using command line script

I am trying to copy a war file from my localhost to a Tomcat web apps folder using command line script in Azure DevOps. My release is getting success but the war file is not getting copying to the destination folder. How to fix this issue?

Path folder mentioned below

enter image description here

question from:https://stackoverflow.com/questions/65713770/unable-to-copy-warfile-from-agent-folder-to-tomcat-folder-in-azuredevops-using-c

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The script you shared echo cd E:apache-tomcat-9.0.41webapps just print cd E:apache-tomcat-9.0.41webapps, check the pic below. We could refer to this doc for more details.

enter image description here

We could copy the file via below cmd. Add task Command line and enter below script

cd {file path}
copy {file name} {target path}

According to the screenshot you shared, you could try below script

cd C:agent\_work
1a\_nitesh482.Devopswarfilewebapparget
copy webapp.war E:apache-tomcat-9.0.41webapps

Result:

enter image description here

Update1

If the file does not exist, we will get the message: The system cannot find the file specified. and error message: [error]Cmd.exe exited with code '1'

enter image description here

Update2

Please ensure that you are using self-hosted agent instead of hosted agent. If you are using hosted agent, we will get the error message, check the pic below.

Self-hosted agent:

enter image description here

Hosted agent:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...