<p>You have two basic scenarios:</p>

<ol>
<li>you have an Azure Pipelines agent running on the target machine</li>
<li>you have an SSH connection to the target machine</li>
</ol>

<p>In the first case you just <code>cp</code> the file to the target location (given that the user running the agent has adequate permissions).
In the second case, you use a task like <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/copy-files-over-ssh" rel="nofollow noreferrer">Copy Files Over SSH task</a> to copy the file. For this latter you have to setup an <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&amp;tabs=yaml#sep-ssh" rel="nofollow noreferrer">SSH service connection</a> in advance.</p>

CC BY-SA 4.0
2019-10-09T11:05:06.250Z
2019-10-09T11:05:06.250Z
Giulio Vian
<p>I know Azure release pipelines can deploy to on-premise servers and other cloud VMs.  My pom.xml file enables Maven to create a .jar file.  My Azure build uses this pom.xml file.  The Azure build works fine by itself; there are no errors when it runs.  I want to place the .jar file on to a Linux server via either the same Azure build pipeline job or a different Azure Release Pipeline.  How do I do this?</p>

<p>I've looked at documentation.  When I changed the build with a <code>pathToPublish:</code> stanza in my Azure build job, the job completes, but there is a warning: </p>

<blockquote>
  <p>[warning]Directory '/home/vsts/work/1/a' is empty. Nothing will be added to build artifact 'MyBuildOutputs'.</p>
</blockquote>

<p>I don't see how "publishWebProjects" would be relevant.  Nothing I am doing is relevant to the web.</p>

<p>When I try to create a new and separate release pipeline in Azure (that will hopefully include the same build pipeline job), the different stages that I choose from never involve deploying to a VM.  Plus none of the options are obvious to me as to how to configure a source (i.e., to use the .jar file from the previous step a build job).  Maybe the source defaults to the Artifact thus created by the Maven build job that I configured.  In the Pipeline job I configured a Git repo as an Artifact, but I am not 100% sure Azure knows I want the .jar file that it can produce with Maven to be the artifact to be deployed as the source of the pipeline job itself.  Which Template, in the Pipeline options for a given stage, do I choose as the stage in a new release pipeline to move a .jar file to a Linux server?</p>

<azure-devops><azure><azure-pipelines>
How do I get Azure Release Pipelines to move a .jar from a Build Pipeline job and place it on a Linux VM?
C. Leeds
# How do I get Azure Release Pipelines to move a .jar from a Build Pipeline job and place it on a Linux VM?

(Asked by: username_0 on 2019-10-08)

I know Azure release pipelines can deploy to on-premise servers and other cloud VMs. My pom.xml file enables Maven to create a .jar file. My Azure build uses this pom.xml file. The Azure build works fine by itself; there are no errors when it runs. I want to place the .jar file on to a Linux server via either the same Azure build pipeline job or a different Azure Release Pipeline. How do I do this?

I've looked at documentation. When I changed the build with a `pathToPublish:` stanza in my Azure build job, the job completes, but there is a warning:

> [warning]Directory '/home/vsts/work/1/a' is empty. Nothing will be added to build artifact 'MyBuildOutputs'.

I don't see how "publishWebProjects" would be relevant. Nothing I am doing is relevant to the web.

When I try to create a new and separate release pipeline in Azure (that will hopefully include the same build pipeline job), the different stages that I choose from never involve deploying to a VM. Plus none of the options are obvious to me as to how to configure a source (i.e., to use the .jar file from the previous step a build job). Maybe the source defaults to the Artifact thus created by the Maven build job that I configured. In the Pipeline job I configured a Git repo as an Artifact, but I am not 100% sure Azure knows I want the .jar file that it can produce with Maven to be the artifact to be deployed as the source of the pipeline job itself. Which Template, in the Pipeline options for a given stage, do I choose as the stage in a new release pipeline to move a .jar file to a Linux server?

**Tags:** azure-devops, azure, azure-pipelines


---

## 1 answers

### Answer by username_1 on 2019-10-09. Score: 2

You have two basic scenarios:

1. you have an Azure Pipelines agent running on the target machine
2. you have an SSH connection to the target machine

In the first case you just `cp` the file to the target location (given that the user running the agent has adequate permissions).
In the second case, you use a task like [Copy Files Over SSH task](https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/copy-files-over-ssh) to copy the file. For this latter you have to setup an [SSH service connection](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml#sep-ssh) in advance.


---

