I have been exploring Bitbucket Pipelines for a while but unfortunately I am not able to get benefit as our application is Java Console Application and we want its build (A generated Jar file) automatically created. Though I have configured .yml for manual build but I am not able to get .jar file whenever I run pipeline by commit or branch.
Where I can specify the outcome of my pipeline in my .yml file? Do I need some server where .jar will be generated?
Hi Faizan,
I'm not 100% sure I understand your question. Are you generating a jar file in your pipeline and looking for an easy way to retrieve that file? If so, the simplest approach would be to define an artifact: https://confluence.atlassian.com/bitbucket/using-artifacts-in-steps-935389074.html That will allow you to download your jar file after running a pipeline. Note that artifacts expire after a few days so you'll need to move them somewhere else for long-term storage.
Another option is indeed to upload the jar file to another server as part of your build, such as deploying it to a maven repository.
Thansk Steven,
I didn't know about artifacts I will try it out. However is there any script that is used to create JAR file just like I click Clean and Build in my Netbeans?
I mean I understand that my resulted outcome will be artifact(jar file). But what script I have to write in order to get that? I have Java Console Application. No Maven No Gradle.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, ok. I understand now. What you need to know is how to build a Netbeans project from the command line. I'm afraid I'm not very familiar with Netbeans so I won't be able to give you very specific help, but generally speaking you'll either need to use a build tool like maven, gradle or ant, or you'll need to run the java compiler (javac) and java archive tool (jar) directly. The latter option may be feasible for a very simple project with few source files and dependencies but for a more complex project you'll definitely be better off with a build tool.
Some quick googling suggests that NetBeans is actually built on top of ant, so you may find that it's relatively simple to use ant to build the project from the command line:
https://netbeans.org/features/java/build-tools.html
https://stackoverflow.com/questions/30007573/compile-netbeans-project-from-command-line-by-using-ant
If you're using ant then you'll need to either use a docker image that has ant installed or you'll need to install ant as part of your pipeline script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's correct. I hope I can get my solution using ant. Thanks for guiding me in the right direction. Probably I will get solution very soon. Though I should move my project to Maven or Gradle.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.
Learn more
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.