The Fullstack-type development space comes with several out-of-the-box extensions that are used to develop CAP applications, such as built-in CDS tools.
Open a new terminal window:
Enter the command cd projects/
:
Run the following command line:
mvn -B archetype:generate -DarchetypeArtifactId=cds-services-archetype -DarchetypeGroupId=com.sap.cds \
-DarchetypeVersion=1.17.0 \
-DgroupId=com.sap.cap -DartifactId=products-service -Dpackage=com.sap.cap.productsservice
Below is an explanation of this parameter.
- archetype:generate: The full name is org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate, where archetype means archetype.
Generate a new project from the prototype, and update the actual project if a partial prototype is used. If the project is fully generated, it is generated in the directory corresponding to its artifactId. If the project is updated with a partial prototype, it is done in the current directory.
Refer to link .
After running, use the prototype to generate the project skeleton:
Open workspace:
Among them, db stores database-related resources, and srv folder stores Java-related codes.
CAP applications use Core Data Services (CDS) to describe:
- Data structure using entity definition (
entity definitons
) - Use services to define how to use data structures
Create a new file in the srv folder and name it ``:
Define an entity definition named Products
:
service AdminService {
entity Products {
key ID : Integer;
title : String(111);
descr : String(1111);
}
}
Execute the mvn clean install command:
Make sure to see the message for BUILD SUCCESSFUL
.
When we used the command line mvn -B archetype:generate
to create the project skeleton before, Application.java
was automatically generated:
The Application.java file can be opened directly with ctrl + p:
Start the template application using the command line mvn clean spring-boot:run
:
Prompt that there is an application listening on port 8080. Click Expose and Open
.
Port 8080 has been exposed and listening services can be accessed externally. To see the mapped URL, use the "Ports: Preview" command.
Open the command panel:
Execute ports:preview
view the url:
I saw the url of the application:
https://workspaces-ws-pdwk4-app1.us10.trial.applicationstudio.cloud.sap
The naming convention for this url:
The highlighted id is the workspace id:
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。