banner



How To Do A Mvn Clean From Azure Devops

Build your Jump Kick project using Azure Pipelines in Azure DevOps

  • Create a simple Spring Boot Maven project and push button it to Azure Repos
  • Build an Azure pipeline to execute a Maven build
  • Build a Docker image for our Spring Boot application using the Spring Boot Maven plugin leveraging Cloud Native Buildpacks
  • Create a Docker Container registry in Azure
  • Push the Docker image to Azure Container Registry
  • Pull the Docker paradigm and run it on your local machine

What Azure DevOps?

Prerequisites:

  • You take admission to Azure DevOps using a Microsoft or Github account. If you don't have one create a free account (5 free users, 1.800 free Azure Pipelines minutes + 2GB of free Azure Artifacts storage).
  • Yous take a Microsoft Azure business relationship (but required to publish Docker containers to the Azure Container Registry). If yous don't take 1, you tin can create i and start for complimentary.
  • Yous have both the Azure CLI and Docker installed.

Create an Azure DevOps project

Create A Spring Boot application

Clone the Azure Repo

          git clone git@ssh.dev.azure.com:v3/yournamehere/spring-boot-case/spring-boot-example        

          git clone git@ssh.dev.azure.com:v3/yourname/spring-boot-example/spring-boot-example          Cloning into 'spring-boot-case'...          remote: Public key hallmark failed.          fatal: Could not read from remote repository.          Please make sure you lot have the correct admission rights          and the repository exists.        

Push the Bound Boot project to the Azure repo

          cd spring-kicking-instance        
          unzip             ~/Downloads/jump-boot-example.zero             -d /tmp
          mv /tmp/spring-boot-example/* .
mv /tmp/jump-boot-example/.* .
          git add .
git commit -m "Initial Spring Boot project"
git push

Create your first Azure pipeline

  • builds the software
  • runs automated test
  • and deploy the application

  • trigger : A list of triggers to offset a new pipeline job. In this case, every commit to master volition exist the trigger to build the projection.
  • pool : Pipeline jobs are executed in a pool of Microsoft-hosted agents. The maintenance and upgrades of those hosted agents are taken care of for you. Each time you run a pipeline, you get a fresh virtual car. The virtual machine is discarded subsequently one use. You lot can specify the proper noun of the VM image you desire to using vmImagein this example, the build will be executed on the latest ubuntu version (ubuntu-latest).
    For a complete listing of VM images, meet the Microsoft hosted agents documentation.
  • Java (AdoptOpenJDK 1.8, xi and 12)
  • Maven 3.six.3
  • Git 2.28.0
  • Docker

  • mavenPomFile: A Project Object Model (POM) is the central unit of measurement of work in Maven. It is an XML file that contains information about the projection and configuration details used by Maven to build the project. Using this holding, you lot can specify the relative path from the repository root to the Maven POM file. For this Leap Boot example application, the pom file is at the root of the project.
    Default value: pom.xml
  • mavenOptions: Sets the MAVEN_OPTS surroundings variable, which is used to send control-line arguments to starting time the JVM. The -Xmx flag specifies the maximum memory available to the JVM.
    Default value: -Xmx1024m
  • javaHomeOption: Sets JAVA_HOME either by selecting a JDK version that will be discovered during builds or by manually inbound a JDK path.
    Default value: JDKVersion
  • jdkVersionOption : The specified JDK version to build the projection. For our project, we use one.11 (Java xi) instead of 1.8 .
    Default value: default
  • jdkArchitectureOption: The architecture (x86, x64) of the JDK
    Default value: x64
  • publishJUnitResults: Whether or not to publish the Junit test results produced by the Maven build to Azure Pipelines.
    Default value:true
  • testResultsFiles: The Maven (unit of measurement) exam reports are generated by the Maven Surefire plugin and are available after a Maven build in the directory: target/surefire-reports. Using this belongings, you tin can specify the path and pattern of exam results files to publish to Azure DevOps.
    Wildcards can be used.
    This belongings is required when publishJUnitResults is set to true.
    Default value: **/surefire-reports/Test-*xml
  • goals: The Maven goal to run. In our case, run the package goal to compile your code, run tests, and package the project into an executable jar file.
    Default value: package

Build a Docker epitome using Cloud Native Buildpacks

Create an Azure Container Registry

Button the Docker image

          docker.io/library/${project.artifactId}:{project.version}        

  • tag the image as the latest
  • execute a docker pushto repositorywith name bound-boot-exampleof the container registry, nosotros configured using the service connection.

Pull and run the Docker epitome

          az login        
          az acr login --proper noun yourcontainerregistry        
          docker pull yourcontainerregistry.azurecr.io/spring-kick-case:latest        
          docker run -p 8080:8080 -d --name spring-boot-example yourcontainerregistry.azurecr.io/spring-kicking-case:latest        

          docker stop spring-boot-example        

Wrapup

Interesting links

  • Azure DevOps: https://dev.azure.com
  • Azure Portal: https://portal.azure.com
  • Azure Pipelines YML schema reference
  • Azure Pipelines Maven Documentation
  • Spring Kick: https://spring.io/projects/spring-kick
  • Deject-Native Buildpacks: https://buildpacks.io

Source: https://medium.com/@TimvanBaarsen/build-your-spring-boot-project-using-azure-pipelines-in-azure-devops-3305977991d

Posted by: wilkinablempoore.blogspot.com

0 Response to "How To Do A Mvn Clean From Azure Devops"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel