War file not getting from download section why?
Asked by PATEL PARTHKUMAR:

image: maven:3.6.3

* pipelines:  
  default:  
  - step:  
  name: Build and Test  
  caches:  
  - maven  
  script:  
  - mvn -B verify --file pom.xml  
  artifacts:  
  - build/target/helpdesk.war  
  after-script:  
  - pipe: atlassian/checkstyle-report:0.3.0  

  - step:  
  name: Generate War File  
  script:  
  - pipe: atlassian/bitbucket-upload-file:0.3.3  
  variables:  
  BITBUCKET_USERNAME: $BITBUCKET_USERNAME  
  BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD  
  FILENAME: "$BITBUCKET_CLONE_DIR/target/helpdesk.war"


Answers:
author: Theodora Boudale
body: Hi [@PATEL PARTHKUMAR](/t5/user/viewprofilepage/user-id/5100426) and welcome to the community.

The first step of your build defines an artifact in the following location:

```
build/target/helpdesk.war
```

This path is relative to the clone directory.

However, in the pipe, you are providing the following path:

```
"$BITBUCKET_CLONE_DIR/target/helpdesk.war"
```

The **build** directory you defined in the first step is missing from this path.

If the file's path (relative to the clone directory) is build/target/helpdesk.war, then you need to use the following in the pipe:

```
"$BITBUCKET_CLONE_DIR/build/target/helpdesk.war"
```

Otherwise, if the file is generated in target/helpdesk.war, then you need to change the artifacts definition and omit the build directory.

Kind regards,  
Theodora

comments: author: PATEL PARTHKUMAR
body: As per your suggestion, I edit my yml file but still getting errors.

image: maven:3.6.3

pipelines:  
default:  
- step:  
name: Build and Test  
caches:  
- maven  
script:  
- mvn -B verify --file pom.xml  
artifacts:  
- $BITBUCKET_CLONE_DIR/target/helpdesk.war  
after-script:  
# Collect checkstyle results, if any, and convert to Bitbucket Code Insights.  
- pipe: atlassian/checkstyle-report:0.3.0  
- step:  
name: Security Scan  
script:  
# Run a security scan for sensitive data.  
# See more security tools at [https://bitbucket.org/product/features/pipelines/integrations?\&category=security](https://bitbucket.org/product/features/pipelines/integrations?&category=security)  
- pipe: atlassian/git-secrets-scan:0.5.1  
- step:  
name: Generate War File  
script:  
- pipe: atlassian/bitbucket-upload-file:0.3.3  
variables:  
BITBUCKET_USERNAME: $BITBUCKET_USERNAME  
BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD  
FILENAME: "$BITBUCKET_CLONE_DIR/target/helpdesk.war"

![Screenshot from 2022-12-14 23-10-30.png](https://community.atlassian.com/t5/image/serverpage/image-id/230487i8365FA15AFEF337D/image-size/large?v=v2&px=999 "Screenshot from 2022-12-14 23-10-30.png")


author: Theodora Boudale
body: Hi [@PATEL PARTHKUMAR](/t5/user/viewprofilepage/user-id/5100426),

The path in the artifacts definition needs to be a path ++relative++ to the clone directory, and additionally, it cannot render variable names. The definition you are using below will ++not++ work:

```
artifacts:
? - $BITBUCKET_CLONE_DIR/target/helpdesk.war
```

I see that you have omitted the 'build' directory from the definition. Where is this .war file generated?

* Is it generated in build/target/helpdesk.war inside the clone directory?
* Or in target/helpdesk.war inside the clone directory?

The first step is to figure this out.

After you figure out where the file is generated, please use a relative path in both the artifacts section and in the pipe as well, to avoid any confusion.

E.g. if the location of the file relative to the clone directory is build/target/helpdesk.war, then use

```
artifacts:
  - build/target/helpdesk.war
```

and the following for the pipe:

```
FILENAME: "build/target/helpdesk.war"
```

If the location of the file relative to the clone directory is target/helpdesk.war, then use

```
artifacts:
  - target/helpdesk.war
```

and the following for the pipe:

```
FILENAME: "target/helpdesk.war"
```

Kind regards,  
Theodora


author: PATEL PARTHKUMAR
body: when I changed this.

```
artifacts:
  - target/helpdesk.war
```

then Its worked perfectly.

Now it's available in the download section.

![Screenshot from 2022-12-16 17-42-20.png](https://community.atlassian.com/t5/image/serverpage/image-id/230825iDD698C299AAC5A5B/image-size/large?v=v2&px=999 "Screenshot from 2022-12-16 17-42-20.png")

Thanks [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086)


Tags: bitbucket-cloud

cloud