Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Installing a jar into my pipeline

So for my project to build, I need to rely on a jar file which can only be retrieved by building it locally (running a specific build tools app which builds the jar file)

I read a few articles stating I can download this app into my pipeline, which will then execute to build the jar I need and cache it.

Now Im at the point where I just don't know how to do that.

Sidenote: I'm very new to maven and all these building steps.

 

Locally on my machine I can build my project just fine, as that jar file is installed in my local maven repo. I just need to figure out how to add the steps to my bitbucket-pipelines.yml file

 

The file that needs to execute is called BuildTools, the site to download it is here:

https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar

From my understanding I need to add this to my bitbucket-pipelines.yml, have it run, and install the output jar into my pipeline maven cache.

IF someone could help me understand the steps/lines I need to add to the yml file to make this magic happen, I would really appreciate it.

 

Thank you!

 

1 answer

1 accepted

1 vote
Answer accepted

Hi @ShaneBeeTK ,

So for my project to build, I need to rely on a jar file which can only be retrieved by building it locally (running a specific build tools app which builds the jar file)

Based on the above I am assuming:

  • You have your Maven project, e.g
    <groupId>here.my.package</groupId>
    <artifactId>my-artifact</artifactId>
    <version>1.0.0-SNAPSHOT</version>
  • BuildTools.jar is used to create a JAR file (e.g my-artifact-1.0.0-SNAPSHOT.jar)

If the above is correct you could, based on documentation - Java with Bitbucket Pipelines :

  1. push your Maven project to a repository in https://bitbucket.org
  2. create a Bash script that will download the BuildTools.jar and place it in whatever location it needs to be
  3. run your Maven build

https://www.spigotmc.org/wiki/buildtools/#what-is-it suggests you on how to download the JAR file under Running BuildTools section 1.2

Since you will be running builds using the same dependency, you could cache them by following Caching dependencies documentation.

So you would end up with something similar to the following bitbucket-pipelines.yml:

image: maven:3.3.9

pipelines: default: - step: caches: - maven  script: - 
bash configure-maven.sh
- mvn clean package

Where configure-maven.sh would:

Kind regards,
Rafael

Thank you very much for the reply.

Im extremely terrible with shell/bash commands, but I will do my best to interpret this and try make this work. 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,826 views 0 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you