Help Center/ AI DataLake/ devg/ Spark UDF Development Guide/ Calling Remote UDAFs in Spark SQL Jobs/ Creating a Maven Project and Configuring the Project Structure
Updated on 2026-11-06 GMT+08:00
Creating a Maven Project and Configuring the Project Structure
Creating a Maven Project and Configuring the Project Structure
The following uses IntelliJ IDEA 2024.3.2.2 as an example.
- Start IntelliJ IDEA and choose File > New > Project. Figure 1 Creating a project
- Choose Maven Archetype and configure the following parameters:
- Name: Enter a project name. In this example, the project name is MyRemoteUDAF.
- Location: Select a path for storing the project. In this example, the project is saved in D:\UDAFTest.
- JDK: Select the JDK 1.8.
- Archetype: Select org.apache.maven.archetypes:maven-archetype-quickstart.
Click Create to create the project.
Figure 2 Creating a Maven project
- Choose src > main and right-click the java folder. Choose New > Package to create a package. Figure 3 Creating a package
Set the package name as you need. In this example, the package name is com.huawei.demo. Then, press Enter.Figure 4 Setting the package name
- Create a Java class file in the package path. In this example, the file name is UDAFDemo. Figure 5 Creating a Java class file
- Add the path for storing the JAR package.
Click File > New > Directory to create a folder for storing the JAR package.
Figure 6 Adding the path for storing the JAR package
In this example, the folder name is lib. Press Enter to confirm the name.
- Import the JAR package.
- Locate the lib directory of the project, paste it to the created lib folder, and click OK in the dialog box that is displayed. Figure 8 Pasting the JAR package to the lib folder
- Configure Project Structure.
- Click File > Project Structure. Figure 9 Clicking Project Structure
- On the navigation pane, choose Libraries. Then click + and select Java. Figure 10 Clicking Java
- Select the JAR package added to the lib folder and click OK. Figure 11 Selecting the JAR package added to the lib folder
- On the displayed Choose Roots dialog box, select only the first folder and click OK. Figure 12 Choose Roots dialog box
- Click OK as prompted. Figure 13 Clicking OK
- Click File > Project Structure.
- Click Artifacts. On the displayed page, click + and then choose JAR > From modules with dependencies. Figure 14 Choosing From modules with dependencies
- In the JAR files from libraries area, enable the first option and click OK. Figure 15 Clicking OK
- Click Apply and then OK. Figure 16 Configuring Artifacts

Parent topic: Calling Remote UDAFs in Spark SQL Jobs
What is your overall rating for this page?
0
1
2
3
4
5
6
7
8
9
10
Very dissatisfiedVery satisfied
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot
