Need help on bitbucket pipeline to run maven script before mavn build

As part of my java maven build, i need to run maven install for one 3rd library.  i have been trying to trigger build, but every time build fails while looking for 3rd library.

I have created a script to install maven library, execution of the script fails.  I need help here.

pipelines:
  default:
    - step:
        script: # Modify the commands below to build your repository.
          - cd $BUILD_DIR/src/lib && mvn install && cd ..
          - mvn clean compile package
+ cd $BUILD_DIR/src/lib && mvn install && cd ..bash: cd: /src/lib: No such file or directoryCompleted at 2016-12-07T01:28:03Z

2 answers

1 accepted

1 vote

Hi Ranga,

Bitbucket Pipelines doesn't set a $BUILD_DIR variable. Your script will automatically be run from within the directory containing your source code, so normally you don't need to refer to it explicitly (ie. normally something like "cd src/lib" should be all you need). But if you do need to refer to your source directory explicitly you can use the variable $BITBUCKET_CLONE_DIR.

Thanks @Steven Vaccarella, "cd src/lib" didn't work but '$BITBUCKET_CLONE_DIR' got worked.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,906 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you