IntelliJ IDEA Build Tool
IntelliJ IDEA provides a Build Tools option to automate the creation of executable application from our source code. It provides the facilities of Compiling, Linking and Packaging the Java code into an executable form.
IntelliJ IDEA supports various Build Tools for java application such as Maven, Gradle, Ant etc. In this section, we will discuss about the Maven and Gradle Build Tools.
Create Maven Project
To create a Maven Projects do the following:
1. Go to File -> New -> Project. A new window screen open.
2. Select Maven in the left pane and click on Next button.
3. New window screen will open. Type the GroupId and ArtifactId. Click Next.
4. Click Finish. It will open the pom.xml file.
5. In this file, we will Add Properties. Final pom.xml file looks like this.
6. Create Java Class.
- Go to src/main/java
- Right click and select New->Java Class.
7. Compile Java Class using Maven
- Go to Run-> Edit Configuration
- Click Green plus icon and select Maven option. A new window will open.
- Enter the Project Name and Package in the Command line.
- Click Ok button.
- Again Go to Run and select Maven_Project option.
- Start Building Package. Upon successful Building, we will see the result.
Create Gradle Project
To create a Gradle Projects do the following:
1. Go to File -> New -> Project. A new window screen open.
2. Select Gradle in the left pane and click on Next button.
3. New window will open. Enter GroupId and ArtifactId. Click Next.
4. Click Finish.
5. Now Start Project. Open build.gradle File and Enter the below code.
6. Compile Project using Gradle
- Go to Run-> Edit Configuration
- Click Green plus icon and select Gradle option. A new window will open
- Enter the Project Name and Tasks.
- Click Ok button.
Again Go to Run and select Gradle_Project option.
Start Building Package. Upon successful Building, we will see the result.