Unable to download artifact Shared artifact: [myhello], pattern: [myhello.war]
Asked by nkchen:

My deployment project always fails due to artifact factor.

1. Build plan runs successfully but I find "Unable to publish artifact" in the build logs. Below is the log details:

Logs  
The following logs have been generated by the jobs in this plan.  
Expand all Collapse all Job Logs  
Default Job Default Stage Download or View  
01-??-1970 08:00:00 \[INFO\] Surefire report directory: D:\\Program Files\\Bamboo-home\\xml-data\\build-dir\\HEL-HEL-JOB1\\target\\surefire-reports  
01-??-1970 08:00:00   
01-??-1970 08:00:00 -------------------------------------------------------  
01-??-1970 08:00:00 T E S T S  
01-??-1970 08:00:00 -------------------------------------------------------  
01-??-1970 08:00:00 Running shijinet.test.TestCase1  
01-??-1970 08:00:00 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.261 sec  
01-??-1970 08:00:00 Running shijinet.test.TestCase2  
01-??-1970 08:00:00 Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.01 sec  
01-??-1970 08:00:00   
01-??-1970 08:00:00 Results :  
01-??-1970 08:00:00   
01-??-1970 08:00:00 Tests run: 5, Failures: 0, Errors: 0, Skipped: 0  
01-??-1970 08:00:00   
01-??-1970 08:00:00 \[INFO\]   
01-??-1970 08:00:00 \[INFO\] --- maven-jar-plugin:2.4:jar (default-jar) @ test ---  
01-??-1970 08:00:00 \[INFO\] Building jar: D:\\Program Files\\Bamboo-home\\xml-data\\build-dir\\HEL-HEL-JOB1\\target\\png-test.jar  
01-??-1970 08:00:00 \[INFO\] ------------------------------------------------------------------------  
01-??-1970 08:00:00 \[INFO\] BUILD SUCCESS  
01-??-1970 08:00:00 \[INFO\] ------------------------------------------------------------------------  
01-??-1970 08:00:00 \[INFO\] Total time: 10.567 s  
01-??-1970 08:00:00 \[INFO\] Finished at: 2016-11-23T17:23:13+08:00  
01-??-1970 08:00:00 \[INFO\] Final Memory: 32M/331M  
01-??-1970 08:00:00 \[INFO\] ------------------------------------------------------------------------  
01-??-1970 08:00:00 Unable to publish artifact \[myhello war\]:

2. The deployment project fails and below is the log details:

Failed: Deployment of release-4 to PNG_latest_jar  
Details  
Releaserelease-4  
master  
TriggerManual run by chenyjCompleted23 Nov 2016 04:22 PMDuration\< 1 secondOn agentDefault AgentStatusFAILED  
The deployment generated 28 lines of output. Download or View full deployment log  
01-??-1970 08:00:00 Build Deployment of 'release-4' on 'PNG_latest_jar' started building on agent Default Agent  
01-??-1970 08:00:00   
01-??-1970 08:00:00 Build working directory is D:\\Program Files\\Bamboo-home\\xml-data\\build-dir\\1671169-1802241  
01-??-1970 08:00:00 Executing build Deployment of 'release-4' on 'PNG_latest_jar'  
01-??-1970 08:00:00 Starting task 'Clean working directory task' of type 'com.atlassian.bamboo.plugins.bamboo-artifact-downloader-plugin:cleanWorkingDirectoryTask'  
01-??-1970 08:00:00 Cleaning working directory 'D:\\Program Files\\Bamboo-home\\xml-data\\build-dir\\1671169-1802241'  
01-??-1970 08:00:00 Finished task 'Clean working directory task' with result: Success  
01-??-1970 08:00:00 Starting task 'Download release contents' of type 'com.atlassian.bamboo.plugins.bamboo-artifact-downloader-plugin:artifactdownloadertask'  
01-??-1970 08:00:00 Preparing to download plan result HEL-HEL-22 artifact: Shared artifact: \[myhello\], pattern: \[myhello.war\]  
01-??-1970 08:00:00 Unable to download artifact Shared artifact: \[myhello\], pattern: \[myhello.war\]  
01-??-1970 08:00:00 Task configuration:  
01-??-1970 08:00:00 artifactId_0 -\> \[-1\]  
01-??-1970 08:00:00 sourcePlanKey -\> \[HEL-HEL\]  
01-??-1970 08:00:00 localPath_0 -\> \[\]  
01-??-1970 08:00:00 Task runtime configuration:  
01-??-1970 08:00:00 securityToken -\> \[a79301fe7ddfb154658fab4060c8da506b1c6954\]  
01-??-1970 08:00:00 runtimeArtifactIds_0 -\> \[0\]  
01-??-1970 08:00:00 artifactName_0 -\> \[myhello\]  
01-??-1970 08:00:00 artifactId_0 -\> \[1736705\]  
01-??-1970 08:00:00 resultKey -\> \[HEL-HEL-22\]  
01-??-1970 08:00:00 artifactLocation_0 -\> \[\]  
01-??-1970 08:00:00 localPath_0 -\> \[\]  
01-??-1970 08:00:00 artifactPattern_0 -\> \[myhello.war\]  
01-??-1970 08:00:00 Finished task 'Download release contents' with result: Error  
01-??-1970 08:00:00 Finalising the build...  
01-??-1970 08:00:00 Stopping timer.  
01-??-1970 08:00:00 Build 1671169-1802241-2064396 completed.  
01-??-1970 08:00:00 Finished processing deployment result Deployment of 'release-4' on 'PNG_latest_jar'


Answers:
author: Alexey Chystoprudov
body: Please check that your artifact is present in working directory. According to provided logs your build generates jar file

```
01-??-1970 08:00:00 [INFO] Building jar: D:\Program Files\Bamboo-home\xml-data\build-dir\HEL-HEL-JOB1\target\png-test.jar
```

But you artifact copy pattern is myhello.war

comments: author: nkchen
body: Yes, I change the artifact setting and now I have artifacts created.

One more thing, I'm using Maven 3.x for compiling and packaging source codes. How to get war file with Maven task? thanks


author: Alexey Chystoprudov
body: <https://maven.apache.org/plugins/maven-war-plugin/usage.html>


author: rsperafico
body: Hello Simon,

It seems the artifact was not published:

```
01-??-1970 08:00:00 Unable to publish artifact [myhello war]:
```

Due to that, the artifact could not be downloaded:

```
01-??-1970 08:00:00 Preparing to download plan result HEL-HEL-22 artifact: Shared artifact: [myhello], pattern: [myhello.war]01-??-1970 08:00:00 Unable to download artifact Shared artifact: [myhello], pattern: [myhello.war]
```

---

Kind regards,  
Rafael P. Sperafico

comments: author: nkchen
body: Yes, its the reason why the deployment step fails. thanks.

Moreover, I want to know how to generate war with maven 3.x task in Bamboo. Could you pls tell me how to ?