Missed Team ’24? Catch up on announcements here.

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

Installing a jar into my pipeline

ShaneBeeTK
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 23, 2019

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
Rafael Pinto Sperafico
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2019

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

ShaneBeeTK
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 25, 2019

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

Atlassian Community Events