Hot questions for Using Azure in azure devops
I'm trying to build CI/CD for multiple java projects that are contained in one repo with Azure pipelines.
For this purpose was requirement to create one pipeline which will build every project with Maven@3 task. The problem is that when we add new project I want that only this one project was built and not every previous project. My file looks like :
resources: - repo: self clean: true lfs: true trigger: branches: include: - feature/* variables: - group: vars stages: - stage: Build pool: vmImage: 'image' jobs: - job: Build strategy: maxParallel: 4 steps: - task: replacetokens@3 inputs: targetFiles: 'settings.xml' - task: Maven@3 inputs: jdkVersionOption: 1.8 mavenPomFile: 'project1/pom.xml' options: '-s $(Build.SourcesDirectory)\settings.xml' goals: 'clean package' - task: Maven@3 inputs: jdkVersionOption: 1.8 mavenPomFile: 'project2/pom.xml' options: '-s $(Build.SourcesDirectory)\settings.xml' goals: 'clean package'
For example project1 is alraedy in develop, so I don't want to do mvn package for it, but only for project2, which is this not merged and has feature branch.
For now this yml won't work because project1 and project2 are in the same repo and this two task will run, which I wan t to avoid.
Is there some way to say "onChange" ???
Unfortunately, this is not possible out of the box which is a shame, to be honest.
The easiest way to handle this would be to create two separate builds. One build for each project you want to build that is located in the same repo and use the path filter like this:
trigger: branches: include: - master - releases/* paths: include: - docs/* exclude: - docs/README.md
Use step templates and define a single build task or job that you can then use across multiple builds so it is easier to maintain if multiple projects have the same build steps.
There are however guides on the internet where people did some Powershell scripting to achieve the mono repo single build solution.
One example would be this:
I have a Java application that can be deployed to a Tomcat 8 App Service from Eclipse using the Azure extensions.
I created a Build pipeline that creates artifacts with the .war file.
I then created a Release pipeline and set up a "Deploy WAR to Azure App Service". The pipeline deploys the war file and expands it, but some other configuration is not right because the app is not available on the Tomcat server.
Has anyone used this task to successfully deploy to a Tomcat 8 App Service? If so, what else needs to be done to get the app to deploy successfully?
P.S. I have very little experience with Java or Tomcat so it's likely something I've missed.
Well, seems you deployed the WAR to Azure App Service (Azure Website) but not the Tomcat server.
You just need to deploy the WAR to Tomcat server instead of Azure Website.
- Build the Java project first, please refer to Working with Azure DevOps and Java and Build your code with Maven for details.
- Install the extension Apache Tomcat Deployment
- Deploy applications to a Tomcat server using the
Deploy to Apache Tomcattask.
Reference below articles to do that:
@Manthan Welcome to StackOverflow. You can use three ways to host your Java Application on Azure:
- Create an Azure VM and host your app:
- Create a Java app on Azure App Service on Windows
- Create an Azure function to host your Java code:
Hope this helps!
I've try to create a pipeline in Azure DevOps. I'm working with Java and Maven, it's a very basic project, just one class/one method and tests.
I've used the maven pipeline template provided by Azure DevOps, but I got a compilation error :
[ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] Source option 5 is no longer supported. Use 6 or later. [ERROR] Target option 1.5 is no longer supported. Use 1.6 or later. [INFO] 2 errors [INFO] -------------------------------------------------------------
I don't know what is
Target. I looked at in the
pom.xml file and in the
azure-pipelines.yml file, but I saw nothing about
What is it and how/where can I change it to
Furthermore, I'm new with Azure DevOps Pipeline and it's my first project with Maven.
Tell me if you need to see my
pom.xml file or my
azure-pipelines.yml file for additionnal information, but there are very basic, I changed nothing (the
pom.xml file was auto-generated by IntelliJ)
Thanks a lot.
Please have a try to add follow script in the pom.xml file.
<properties> <maven.compiler.source>1.6</maven.compiler.source> <maven.compiler.target>1.6</maven.compiler.target> </properties>
For more information, please refer to this issue.