Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

maven - Build a jar file from project folder in a specific location of git repository using azure devops

I am having a git repository for my project with a structure as shown below. enter image description here enter image description here The structuring is based on the source, all the codes, scripts related to a source is kept under the respective source folder. The scripts and code consists of sql, scala, pyhton...all kind of files used for that source.

Now for one of the source, I have to create a jar file.

  1. For that I have created a project in IntelliJ using sbt build and create jar file.
  2. Create a folder under respective source and copy the entire project into the created folder as below.

enter image description here enter image description here

I have to use azure devops for creating jar file and store it in a dbfs location. There are two things i have to get clarity on.

  1. How to create a jar file from this location of repository using sbt build file from devops? I tried with devOps, but could not see any agent job to create jar file from sbt file. enter image description here
  2. If I could convert this sbt file into pom.xml, how could i create a jar file from this location of repository using devops?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You should have sbt available on Ubuntu host agent. Here you have an example YAML code:

name: sbt

trigger:
- master

variables:
  sbtFileDirectory: '<pass your folder where sbt file is>'
pool:
  vmImage: 'ubuntu-latest'
steps:
- script: sbt clean
  displayName: 'Running $ sbt clean'
  workingDirectory: $(sbtFileDirectory)
- script: sbt update
  displayName: 'Running $ sbt update'
  workingDirectory: $(sbtFileDirectory)
- script: sbt compile
  displayName: 'Running $ sbt compile'
  workingDirectory: $(sbtFileDirectory)
- script: sbt test
  displayName: 'Running $ sbt test'
  workingDirectory: $(sbtFileDirectory)

With classic/release pipelines it would be similar:

enter image description here

You can also monitor this topic on developer community - Scala and SBT builder


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...