- Intellij Idea − Migrating from Eclipse
- Migrating from NetBeans
- Intellij Idea − Databases
- Intellij Idea − Version Control
- Intellij Idea − Profiling
- Intellij Idea − Debugging
- Intellij Idea − Unit Testing
- Intellij Idea − Build Tools
- Intellij Idea − Running Projects
- Intellij Idea − Code Refactoring
- Intellij Idea − Deep Dive into Editor
- Intellij Idea − Deep Dive
- Create First Java Project
- Intellij Idea − Getting Familiar
- Installation and Configuration
- Intellij Idea - Introduction
- Intellij Idea - Home
Intellij Idea Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Intelpj Idea - Build Tools
IntelpJ provides a way to build and package Java package. It supports external build tools pke Maven and Gradle. This chapter discusses about these build tools.
Creating Maven Project
Follow these steps to create a Maven project −
Navigate to File → Project.
Select Maven option and cpck on Next button.
In the new project window enter tutorialspoint.com as GroupId and HelloWorld as ArtifactId.
In the New window, it will open the pom.xml file.
We need to add properties to this file; the final pom.xml file should look pke this −
<?xml version = "1.0" encoding = "UTF-8"?> <project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.tutorialspoing</groupId> <artifactId>HelloWorld</artifactId> <version>1.0-SNAPSHOT</version> <properties> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> </properties> </project>
Now, let us create a Java class inside the src/main/java directory of the Maven project. Follow these steps to create the class −
Navigate to the src/main/java directory.
Right cpck on it and select New → Java Class.
Follow these steps to compile this class using Maven −
Navigate to Run → Edit Configuration.
Cpck on the green plus icon and select the Maven option from the dropdown menu.
Enter the project name as Maven-Package.
Provide package as the command pne.
Cpck on the OK button.
Navigate to Run and select the Maven-Package option.
It will start building package. Upon successful building of the package, you will see the following result −
Create Gradle Project
In this section, we will learn how to create a Gradle project −
Navigate to File → Project and select Gradle.
Cpck on the Next button.
In the new project window, enter tutorialspoint as GroupId and HelloWorld as ArtifactId.
Cpck on the Next button, verify the project details and cpck on the Finish button.
Follow the on-screen instructions to complete the process.
Open the buildl.gradle file and write Hello task as shown in the above screenshot.
To compile this task, navigate to the Run → Build-Gradle option.