To release a UDF or MapReduce to the MaxCompute server for production use, you must complete packaging, uploading, and registration in sequence. You can use the one-click release function to complete these procedures. MaxCompute Studio runs the mvn clean package command, uploads a JAR package, and registers the UDF in one stop. To use this function, right-click the UDF or MapReduce and select Deploy to server…. Make sure that the target class is in the src > main > java subdirectory and is successfully compiled on the Maven module. The dialog box shown in the following figure appears. Select the MaxCompute project to be deployed and enter a resource name and a function name. Click OK and wait until the operation in the background is complete.
If you require special packaging, you can modify relevant settings in the pom.xml file. After packaging, follow these steps to upload the JAR package and register the UDF.
After the JAR package is prepared, upload it to the MaxCompute server.
Select Add Resource from the MaxCompute menu.
Select the MaxCompute project you want to upload the resource to, the JAR file path, and the resource name you want to register. Determine whether to force update when the resource or function already exists. Then click OK.
After uploading is successful, you can view the resource under the Resources node of the Project Explorer window.
After the JAR package is uploaded, register the UDF.
Select Create Function from the MaxCompute menu.
Select the required resource JAR and JAR main class, and enter the function name. Click OK.
After the registration is successful, you can view the function under the Functions node of the Project Explorer window.
Apply the UDF in SQL to complete subsequent development.