Updated on 2025-10-23 GMT+08:00

Packaging IntelliJ IDEA Code

Scenario

Export a JAR package using IntelliJ IDEA and specify the name of the JAR package, for example, storm-examples.jar.

Procedure

  1. If the Storm-JDBC sample needs to run in Windows, replace the configuration file path. Otherwise, skip this step.

    1. Right-click the jdbc.properties file on the IDEA page, choose Copy Path/Reference > Absolute Path, and copy the path of the jdbc.properties file.
      Figure 1 Copy the jdbc.properties File Path
    2. Change the value of proPath in the main() method of SimpleJDBCTopology.java to the path of the jdbc.properties file copied from 1.a.
      Figure 2 Modify the proPath Path

  2. In IntelliJ IDEA, configure the Artifacts information for the project before the JAR package is generated.

    1. Enter IntelliJ IDEA and choose File > Project Structure.
    2. On the Project Structure page, select Artifacts, click the plus sign (+), and choose JAR > Empty.
      Figure 3 Adding Artifacts

    3. Set the name, type, and output path of the JAR package based on site requirements.
      Figure 4 Configuring basic information
    4. Choose 'storm-examples' , right-click Put into Output Root, and click Apply.
      Figure 5 Put into Output Root
    5. Click OK to complete the configuration.

  3. Generate the JAR package.

    1. Enter IntelliJ IDEA and choose Build > Build Artifacts....
      Figure 6 Build Artifacts
    2. In the displayed interface, choose storm-examples:jar > Build the JAR package.
      Figure 7 Build
    3. If log similar to the following is displayed in event logs, the JAR package is successfully generated. Obtain the JAR package from the Outputdirectory configured shown in Figure 4
      14:37 Compilation completed successfully in 25 s 991 ms