Now that GitActions is in preview, have git do the maven build and deploy it to WebApps
First, create a Maven + Tomcat Java application
maven wrote as follows
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<RESOURCEGROUP_NAME>DeployTest</RESOURCEGROUP_NAME>
<WEBAPP_NAME>MavenJsptest</WEBAPP_NAME>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>ROOT</finalName> <!-- Azure default root pass -->
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<packagingExcludes>WEB-INF/lib/javax.servlet-api-3.0.1.jar</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>
Especially packed is the finalName </ font> part, which is the name of the war file name generated by mvn install. Since WebApps goes to refer to ROOT and below by default, an error occurred if it was specified other than this.
Once you've created your app, push it to GitHub
Create an App Service Plan and Web Apps (Java environment matches the app), select "Deploy Center", and select GitAction or the repository of the created app.
At the end, yaml is output, but if you look inside it, you can see that Java version selection and mvn clean install are done.
If you do so far, you can see that the action on GitHub is working. If there are no problems, it will be deployed and can be accessed normally.
Jenkins and Azure Pipeline are also great tools, but I was worried that setting and building was a little troublesome, so this time GitActions was very easy because I could use it without building if I registered GitHub and Azure.
I didn't edit yaml this time, but I think that it can be developed more effectively by customizing it (running unit tests, etc.).
Recommended Posts