War file not getting from download section why?

PATEL PARTHKUMAR December 13, 2022

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"

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 14, 2022

Hi @PATEL PARTHKUMAR 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

PATEL PARTHKUMAR December 14, 2022

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
- 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

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 16, 2022

Hi @PATEL PARTHKUMAR,

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

Like PATEL PARTHKUMAR likes this
PATEL PARTHKUMAR December 16, 2022

 

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

 

Thanks @Theodora Boudale 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events