YouTip LogoYouTip

Maven Intellij

IntelliJ IDEA has built-in support for Maven. In this example, we are using IntelliJ IDEA Community Edition 11.1. Some features of IntelliJ IDEA are listed below: * You can run Maven goals through IntelliJ IDEA. * You can view the output of Maven commands in IntelliJ IDEA's own terminal. * You can update Maven dependencies within the IDE. * You can initiate Maven builds in IntelliJ IDEA. * IntelliJ IDEA automates dependency management based on Maven's pom.xml. * IntelliJ IDEA can resolve Maven dependencies within its own workspace without needing to install them to the local Maven repository, provided the dependent projects are in the same workspace. * IntelliJ IDEA can automatically download required dependencies and source code from remote Maven repositories. * IntelliJ IDEA provides wizards for creating Maven projects and pom.xml files. ## Creating a New Project in IntelliJ IDEA Use the New Project wizard to import a Maven project. * Open IntelliJ IDEA. * Select the **File Menu > New Project** option. * Select the **import project from existing model** option. !(#) * Select the **Maven** option. !(#) * Select the project path, which is the storage path when creating a project with Maven. Let's assume we have created a project named **consumerBanking**. See [**Maven Creating Java Project**](#) to learn how to create a project with Maven. !(#) * Select the Maven project to import. !(#) * Enter the project name and click "finish". !(#) Now, we can see the Maven project in IntelliJ IDEA. Looking at the Libraries and Test Libraries of the consumerBanking project, you will find that IntelliJ IDEA has added all Maven dependencies to its build path. !(#) ## Building a Maven Project in IntelliJ IDEA Alright, next let's build this Maven project using IntelliJ IDEA's compilation feature. * Select the consumerBanking project. * Select the **Build menu > Rebuild Project** option. You can see the build process output log in IntelliJ IDEA's terminal: 4:01:56 PM Compilation completed successfully ## Running the Application in IntelliJ IDEA * Select the consumerBanking project. * Right-click on App.java to bring up the context menu. * Select **Run App.main()**. !(#) You will see the following run result in IntelliJ IDEA's terminal: "C:Program FilesJavajdk1.6.0_21binjava"-Didea.launcher.port=7533 "-Didea.launcher.bin.path= C:Program FilesJetBrainsIntelliJ IDEA Community Edition 11.1.2bin"-Dfile.encoding=UTF-8 -classpath "C:Program FilesJavajdk1.6.0_21jrelibcharsets.jar; C:Program FilesJavajdk1.6.0_21jrelibdeploy.jar; C:Program FilesJavajdk1.6.0_21jrelibjavaws.jar; C:Program FilesJavajdk1.6.0_21jrelibjce.jar; C:Program FilesJavajdk1.6.0_21jrelibjsse.jar; C:Program FilesJavajdk1.6.0_21jrelibmanagement-agent.jar; C:Program FilesJavajdk1.6.0_21jrelibplugin.jar; C:Program FilesJavajdk1.6.0_21jrelibresources.jar; C:Program FilesJavajdk1.6.0_21jrelibrt.jar; C:Program FilesJavajdk1.6.0_21jrelibextdnsns.jar; C:Program FilesJavajdk1.6.0_21jrelibextlocaledata.jar; C:Program FilesJavajdk1.6.0_21jrelibextsunjce_provider.jar; C:Program FilesJavajdk1.6.0_21jrelibextsunmscapi.jar; C:Program FilesJavajdk1.6.0_21jrelibextsunpkcs11.jar C:MVNconsumerBankingtargetclasses; C:Program FilesJetBrains IntelliJ IDEA Community Edition 11.1.2libidea_rt.jar" com.intellij.rt.execution.application.AppMain com.companyname.bank.AppHello World!Process finished with exit code 0
← Python3 Func OpenMaven Eclipse β†’