Alibaba Cloud Cloud Development Web Application Training Camp-Detailed explanation of the second clock-in task

Alibaba Cloud Cloud Development Web Application Training Camp-Detailed explanation of the second clock-in task

Don't talk nonsense, just start.

1. Preparation stage

阿里云云开发平台访问地址:https://workbench.aliyun.com/application
任务使用的代码仓库地址:https://github.com/heissuper/taskmanager

Clone the code used by the task to the local.

Two, create a new application

Log in to the cloud development platform, click [Create New Application] to
Create new application
select an application scenario
Click [Technical Scenario] to select [Microservice]
Solution Select [SpringBoot Application Migration Solution (SAE)] or [SpringBoot Application Migration Solution (ASK)]

Choose the first [SpringBoot Application Migration Solution (SAE)] here and click Next.
Choose application scenario
Fill in the basic information and click Finish.
Application Name: Task Management System Migration Serverless
Application Introduction: Task Management System Migration Serverless
Fill in basic application information
Click [Environment Management] to ensure that all dependent cloud services have been activated, [Specifications] in the daily environment under advanced settings have been configured, and click OK after checking.Check cloud services
Open all dependent cloud services

3. Import the code into the cloud development platform, modify the code for migration

Click [Development and Deployment] to open Cloud IDE
Open Cloud IDE

Drag and drop the directory [src] file [pom.xml] in the cloned code directly into the Cloud IDE.
Import code
Modify pom.xml,
open pom.xml and find the properties on lines 13 to 18 and add <applicationName>${project.artifactId}</applicationName>
it to the tag. Add the code block

<properties>
	<java.version>1.8</java.version>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<spring-boot.version>2.2.6.RELEASE</spring-boot.version>
	<mybatisplus.version>3.3.2</mybatisplus.version>
</properties>

change into

<properties>
	<java.version>1.8</java.version>
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	<spring-boot.version>2.2.6.RELEASE</spring-boot.version>
	<mybatisplus.version>3.3.2</mybatisplus.version>
	<applicationName>${project.artifactId}</applicationName>
</properties>

Find the 94 line build tag at the bottom of the file and press Enter after the tag to add a line
<finalName>${applicationName}</finalName>
to the following code block

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.1</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<version>${spring-boot.version}</version>
				<configuration>
					<mainClass>com.alibaba.workbench.taskmng.Application</mainClass>
					<layout>ZIP</layout>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>repackage</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

change into

<build>
	<finalName>${applicationName}</finalName>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.1</version>
			<configuration>
				<source>1.8</source>
				<target>1.8</target>
				<encoding>UTF-8</encoding>
			</configuration>
		</plugin>
		<plugin>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-maven-plugin</artifactId>
			<version>${spring-boot.version}</version>
			<configuration>
				<mainClass>com.alibaba.workbench.taskmng.Application</mainClass>
				<layout>ZIP</layout>
			</configuration>
			<executions>
				<execution>
					<goals>
						<goal>repackage</goal>
					</goals>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

[Ctrl+S] Save the modified pom.xml file, and submit and push all the codes to the code warehouse.
Submit code and push to the code warehouse
1- Click on the source code management window
2- Input submission instructions
3- Submit code
4- Click to open more operations
5- Push the code to the code warehouse
Note: Be sure to save the modified pom.xml file and push all the code To the code warehouse.
Note: Be sure to save the modified pom.xml file and push all the codes to the code warehouse.
Note: Be sure to save the modified pom.xml file and push all the codes to the code warehouse.

Tell the important thing three times

Four, test application

Click the terminal tab at the bottom of Cloud IDE and
enter mvn spring-boot:run. The
online test
application starts successfully, and click the preview button.
Start successfully
Enter the port to be exposed in the top pop-up box. Enter the port to be exposed.
Port exposure
After pressing Enter, a prompt will appear at the bottom right of whether to access immediately. You can enter the accessible domain name address by directly clicking Visit.
Port mapping succeeded
Note: It is possible to start the test here The following problems will occur.
Startup error
Startup error
If you have the above problems, you need to run in the terminal now

mvn clean install spring-boot:repackage

Execute here after

mvn spring-boot:run

Thank you UnKnownCode for answering this question.

Five, deploy and access the application

Click the wb icon in the upper left corner of Cloud IDE, select the application deployment environment [Daily Environment], and click the [Deploy] button to deploy.
Application deployment
Wait for the application packaging, image building, application deployment and other processes.
Application packaging
After the application is deployed, it prompts [cloud development application [test] environment deployment successful], which means that my project has been successfully migrated. . .
It succeeded.
Find [Please use http://XXX.workbenchapi.com for test verification] in the prompt message to copy the domain name to the browser to open, take a screenshot, and fill in the check-in information.
carry out

6. Application offline

The important thing is here again. . .
After completing the check-in, you must remember to take the application offline, otherwise you may incur costs.
After completing the check-in, you must remember to take the application offline, otherwise you may incur costs.
After completing the check-in, you must remember to take the application offline, otherwise you may incur costs.
The important thing is said three times.
Click the slider after the daily routine and the application will be offline. The
Offline application
Cloud IDE prompts [Cloud development application [TEST] environment to uninstall successfully!], which means that the application is offline successfully.
App offline

After the application is offline, confirm that the application is in the [offline] status
App offline
over!!

Guess you like

Origin blog.csdn.net/qq_21739761/article/details/108710005