Как добавить зависимость в gradle intellij idea
Перейти к содержимому

Как добавить зависимость в gradle intellij idea

  • автор:

Gradle dependencies

IntelliJ IDEA lets you add and manage dependencies in your Gradle project. You can add dependencies and view them in the diagram.

Generate Gradle dependencies

Any dependency added to the project is managed by Gradle. The best way to add or manage a dependency is in the build.gradle file. Dependencies that you set up manually inside IntelliJ IDEA module settings will be discarded on the next Gradle project reload.

Add a Gradle dependency

  1. Open the build.gradle file in the editor.
  2. Press Alt+Insert to open the Generate context menu.
  3. From the context menu, select Add Maven artifact dependency . Add dependencyThe Maven Artifact Search window opens.
  4. In the Maven Artifact Search window, in the search field, start typing the name of your dependency. In the list of results select the one you need and click Add . Search Artifact
  5. Reload your project. IntelliJ IDEA adds a dependency to the build.gradle file. Build script: added dependencyIntelliJ IDEA also adds the dependency to the Dependencies node in the Gradle tool window and to the External Libraries in the Project tool window. Gradle tool window and Project tool windowIf the added dependency has its own transitive dependencies, IntelliJ IDEA displays them in both tool windows. Besides the transitive dependencies, IntelliJ IDEA also indicates cyclic dependencies in the Gradle tool window. Gradle tool window: cyclic dependenciesIf you add a dependency configuration of the source set, it will be displayed in the Gradle tool window as well. Source set dependency

View dependencies as a diagram

Make sure you have the bundled Diagrams and Gradle Extension plugins enabled. Also, make sure you have the Gradle version 4.5 or later.

You can work with Gradle dependencies in the diagram format. It might be helpful when you have a large project and want to see the whole picture of how dependencies (including the transitive ones) are connected inside the project.

  1. In the Gradle tool window, select a project, on the toolbar, click or select the Show Dependencies option from the context menu. the Show Dependencies optionYou can select the Show Dependencies Popup ( Ctrl+Alt+U ) option to open the graph in a separate window. To close the popup, press Escape .
  2. In the diagram window, IntelliJ IDEA displays all project dependencies including the transitive ones. Gradle dependencies diagramWhen you navigate to a dependency in a graph, IntelliJ IDEA displays its version, group and artifact IDs. Show dependency information

Use the diagram window toolbar to manage the diagram. You can change the size of a diagram, export it to a file, see only a part of the diagram you are interested in, and so on.

Change the visibility level

You can change the visibility level and, for example, view dependencies that have a specific scope (compile, test, and so on).

Hold down Alt and move the caret to zoom in on the parts of the diagram.

In Android and Kotlin projects IntelliJ IDEA supports only the default visibility level.

  1. In the diagram window, select the project and click .
  2. From the list, select the dependency scope you want to see. IntelliJ IDEA displays only the specified dependency scope.

Show path from selection to root

You can select dependencies and see how they are connected to the root.

  1. In the diagram window, select a dependency for which you want to see the connection to a project. If you want to select several dependencies at once, hold down Shift and make the selection.
  2. On the toolbar, click.

Show neighbors of the selected nodes

You can select dependencies and see what other dependencies are connected to the selected nodes. It might be helpful if you have a large diagram and want to focus on just a part of it.

  1. In the diagram window, select a dependency you need. If you want to select several dependencies at once, hold down Shift and make the selection.
  2. On the toolbar, click.

Search for a specific dependency in the graph

  1. In the diagram window, press Ctrl+F to open the Diagram Elements popup. Search for dependency
  2. Start typing a name of a dependency you want to find, select the one you need from the list of search results and press Enter . IntelliJ IDEA locates the needed dependency in the graph. Found dependency

View the diagram structure

  1. Generate a diagram.
  2. Click Structure in the left toolbar. IntelliJ IDEA opens the Structure tool window that displays a map of your diagram with a small preview of the selected block and its neighbors. the Structure viewUse the context menu to zoom in and out, move canvas, change layout, and export part of the diagram into an image. the context menu

Dependency analyzer

Gradle dependency analyzer lets you quickly see and analyze resolved dependencies, the unresolved ones, dependencies with conflicts, and transitive dependencies in your project and subprojects.

Analyze dependencies

Resolved dependencies

  1. On the toolbar in the Gradle tool window, click . Alternatively, in the Gradle tool window, right-click the needed dependency and select Analyze Dependencies from the context menu. You can also right-click a module in the Project view and use the same action.
  2. In the Dependency Analyzer window, you can narrow down your analysis scope, check only the conflicted dependencies, or check usages. If you want to see the needed dependency in the build.gradle file, right-click the dependency in the Usages part and select Go to Gradle Dependency . If you click Open Gradle Config on the project node, IntelliJ IDEA will open the build.gradle file. You can also click Go to Package Search to navigate to the dependency in question in the Work with the Dependencies tool window. If the duplicate dependency is found, it will be greyed out. For more information about available options and icons in the Dependency Analyzer window, refer to the reference section.

Dependency analyzer tool window reference

You can see scopes in which every dependency is used in the project. To narrow down the list of the dependencies based on their scope, select the appropriate option from the list of scopes.

Show Conflicts Only

Click to see only unresolved or conflicted dependencies.

Click and select Show GroupId to display GroupId in the list of dependencies.

Toggle to display the list of dependencies in a form of nodes or in the flat list.

The tree view will help you quickly check the transitive dependencies.

Use / expand or collapse the list of dependencies.

Gradle dependencies

IntelliJ IDEA lets you add and manage dependencies in your Gradle project. You can add dependencies and view them in the diagram.

Generate Gradle dependencies

Any dependency added to the project is managed by Gradle. The best way to add or manage a dependency is in the build.gradle file. Dependencies that you set up manually inside IntelliJ IDEA module settings will be discarded on the next Gradle project reload.

Add a Gradle dependency

  1. Open the build.gradle file in the editor.
  2. Press Alt+Insert to open the Generate context menu.
  3. From the context menu, select Add Maven artifact dependency . Add dependencyThe Maven Artifact Search window opens.
  4. In the Maven Artifact Search window, in the search field, start typing the name of your dependency. In the list of results select the one you need and click Add . Search Artifact
  5. Reload your project. IntelliJ IDEA adds a dependency to the build.gradle file. Build script: added dependencyIntelliJ IDEA also adds the dependency to the Dependencies node in the Gradle tool window and to the External Libraries in the Project tool window. Gradle tool window and Project tool windowIf the added dependency has its own transitive dependencies, IntelliJ IDEA displays them in both tool windows. Besides the transitive dependencies, IntelliJ IDEA also indicates cyclic dependencies in the Gradle tool window. Gradle tool window: cyclic dependenciesIf you add a dependency configuration of the source set, it will be displayed in the Gradle tool window as well. Source set dependency

View dependencies as a diagram

Make sure you have the bundled Diagrams and Gradle Extension plugins enabled. Also, make sure you have the Gradle version 4.5 or later.

You can work with Gradle dependencies in the diagram format. It might be helpful when you have a large project and want to see the whole picture of how dependencies (including the transitive ones) are connected inside the project.

  1. In the Gradle tool window, select a project, on the toolbar, click or select the Show Dependencies option from the context menu. the Show Dependencies optionYou can select the Show Dependencies Popup ( Ctrl+Alt+U ) option to open the graph in a separate window. To close the popup, press Escape .
  2. In the diagram window, IntelliJ IDEA displays all project dependencies including the transitive ones. Gradle dependencies diagramWhen you navigate to a dependency in a graph, IntelliJ IDEA displays its version, group and artifact IDs. Show dependency information

Use the diagram window toolbar to manage the diagram. You can change the size of a diagram, export it to a file, see only a part of the diagram you are interested in, and so on.

Change the visibility level

You can change the visibility level and, for example, view dependencies that have a specific scope (compile, test, and so on).

Hold down Alt and move the caret to zoom in on the parts of the diagram.

In Android and Kotlin projects IntelliJ IDEA supports only the default visibility level.

  1. In the diagram window, select the project and click .
  2. From the list, select the dependency scope you want to see. IntelliJ IDEA displays only the specified dependency scope.

Show path from selection to root

You can select dependencies and see how they are connected to the root.

  1. In the diagram window, select a dependency for which you want to see the connection to a project. If you want to select several dependencies at once, hold down Shift and make the selection.
  2. On the toolbar, click.

Show neighbors of the selected nodes

You can select dependencies and see what other dependencies are connected to the selected nodes. It might be helpful if you have a large diagram and want to focus on just a part of it.

  1. In the diagram window, select a dependency you need. If you want to select several dependencies at once, hold down Shift and make the selection.
  2. On the toolbar, click.

Search for a specific dependency in the graph

  1. In the diagram window, press Ctrl+F to open the Diagram Elements popup. Search for dependency
  2. Start typing a name of a dependency you want to find, select the one you need from the list of search results and press Enter . IntelliJ IDEA locates the needed dependency in the graph. Found dependency

View the diagram structure

  1. Generate a diagram.
  2. Click Structure in the left toolbar. IntelliJ IDEA opens the Structure tool window that displays a map of your diagram with a small preview of the selected block and its neighbors. the Structure viewUse the context menu to zoom in and out, move canvas, change layout, and export part of the diagram into an image. the context menu

Dependency analyzer

Gradle dependency analyzer lets you quickly see and analyze resolved dependencies, the unresolved ones, dependencies with conflicts, and transitive dependencies in your project and subprojects.

Analyze dependencies

Resolved dependencies

  1. On the toolbar in the Gradle tool window, click . Alternatively, in the Gradle tool window, right-click the needed dependency and select Analyze Dependencies from the context menu. You can also right-click a module in the Project view and use the same action.
  2. In the Dependency Analyzer window, you can narrow down your analysis scope, check only the conflicted dependencies, or check usages. If you want to see the needed dependency in the build.gradle file, right-click the dependency in the Usages part and select Go to Gradle Dependency . If you click Open Gradle Config on the project node, IntelliJ IDEA will open the build.gradle file. You can also click Go to Package Search to navigate to the dependency in question in the Work with the Dependencies tool window. If the duplicate dependency is found, it will be greyed out. For more information about available options and icons in the Dependency Analyzer window, refer to the reference section.

Dependency analyzer tool window reference

You can see scopes in which every dependency is used in the project. To narrow down the list of the dependencies based on their scope, select the appropriate option from the list of scopes.

Show Conflicts Only

Click to see only unresolved or conflicted dependencies.

Click and select Show GroupId to display GroupId in the list of dependencies.

Toggle to display the list of dependencies in a form of nodes or in the flat list.

The tree view will help you quickly check the transitive dependencies.

Use / expand or collapse the list of dependencies.

Gradle

IntelliJ IDEA supports a fully-functional integration with Gradle that helps you automate your building process. You can easily create a new Gradle project, open and sync an existing one, work with several linked projects simultaneously, and manage them.

You can also create a Gradle project and store it in the WSL environment or open it from the WSL file system. For more information, refer to the WSL section.

Create a new Gradle project

  1. Launch the New Project wizard. If no project is currently opened in IntelliJ IDEA, click New Project on the welcome screen. Otherwise, select File | New | Project from the main menu.
  2. Name the new project and change its location if necessary.
  3. Select the Create Git repository to place the new project under version control. You will be able to do it later at any time. The .gitignore file is generated in any case.
  4. Select a language that you want to use in your project. Click if you want to add other languages available via plugins.
  5. Select Gradle in the list of Build system .
  6. Specify project’s SDK (JDK) or use the default one. If you don’t have a JDK on your machine, IntelliJ IDEA can quickly download the JDK for you. The Gradle project sync will wait until the JDK is downloaded.
  7. The selected Add sample code option will create a file with a basic code sample.
  8. Select Gradle DSL . You can select Groovy for traditional syntax or Kotlin as an alternative.
  9. In Advanced Settings , specify the fields which resemble the Maven coordinates. These settings might be helpful if you decide to deploy your project to a Maven repository. The fields you specify are added to the build.gradle file.
    • Gradle distribution : select Gradle wrapper that is a default-preferable option or Local installation when you want to use the specific local Gradle version.
    • Gradle version : if the wrapper option is selected, the latest Gradle distribution will be used unless you unselect the Auto-select option and select the specific version from the drop-down list. Alternatively, if the Local installation was selected then the version you defined locally is used.
    • Auto-select : unselect this option to specify the Gradle version you want to use in your project.
    • Use these settings for future projects : select this checkbox to use the configured Gradle version in your future projects.
    • GroupId — groupId of the new project. You can omit this field if you plan to deploy your project locally.
    • ArtifactId — artifactId that is added as a name of your new project.
    • Version — version of the new project. By default, this field is specified automatically.

For more information about Maven coordinates, refer to Maven naming conventions.

Create a Java EE project with Gradle as a build tool

  1. Launch the New Project wizard. If no project is currently opened in IntelliJ IDEA, click New Project on the welcome screen. Otherwise, select File | New | Project from the main menu.
  2. Under the Generators section, select Jakarta EE .
  3. Configure your project selecting the appropriate options such as your project’s name, location, language, and select Gradle as your build tool.
  4. Click Create . IntelliJ IDEA creates a Gradle project with the dedicated Gradle tool window and adds necessary dependencies. For the more detailed information, refer to Tutorial: Your first Java EE application.

Open an existing Gradle project

If you have the offline mode enabled in your project, the opening or re-importing of the project might fail. To fix the issue, disable the offline mode and re-import your project.

  1. If no project is currently opened in IntelliJ IDEA, click Open on the welcome screen. Otherwise, select File | Open from the main menu. If you have some custom plugins that require you to import your project from the IntelliJ IDEA model, press Ctrl+Shift+A and search for the Project from Existing Sources action.
  2. In the dialog that opens, select a directory containing a Gradle project and click OK . IntelliJ IDEA opens and syncs the project in the IDE.

If you need to adjust the Gradle settings options, refer to Gradle settings.

Check Gradle JVM and language level

  • Gradle JVM : when IntelliJ IDEA opens the Gradle project, it checks the gradle.properties file for the appropriate JVM version specified in org.gradle.java.home and uses it for the project. If it is not specified, then the project SDK is used. Alternatively, you can use the Gradle settings to configure the Gradle JVM.
  • Language level : the language level settings are applied for a source root or for a module. If a Gradle project has a single linked project then the project default language level is set to the minimum language level among the module language levels. The module language level is set to sourceCompatibility in the build.gradle file. The preview part is set to the conjunction of preview flags of the module source sets. The source set module language level is set to the corresponding combination of sourceCompatibility property and —enable-preview flag.

Link a Gradle project to an IntelliJ IDEA project

You can have multiple Gradle projects inside one IntelliJ IDEA project. It might be helpful if you keep parts of code in different projects, have some legacy projects on which you need to work, have Gradle composite build or work with microservices. You can link such projects in IntelliJ IDEA and manage them simultaneously.

When you open a Gradle project, the link of the project is established automatically and the Gradle tool window is enabled.

If an IntelliJ IDEA project is not linked to a Gradle project, then the Gradle tool window is disabled. In this case, IntelliJ IDEA displays a message with a link that quickly lets you reimport your Gradle project and enable the Gradle tool window. If the Gradle tool window is active, then you have at least one Gradle project linked.

  1. Open the Gradle tool window.
  2. In the Gradle tool window, click to attach a Gradle project.
  3. In the dialog that opens, select the desired build.gradle file, and click OK .
  4. In the Import Module from Gradle window, specify options for the Gradle project that you are trying to link and click OK . The project is linked. The Gradle tool window shows the toolbar and a tree view of Gradle entities.

If you need to link back the previously unlinked project, in the Project tool window, right-click the added build.gradle or if it is a Gradle Kotlin module the build.gradle.kts file and select Import Gradle Project .

Add a new Gradle module to an existing Gradle project

You can add a Gradle module to a project in which you are already working.

  1. In the main menu, go to File| New | Module to open the New Module wizard .
  2. If the existing project is not the Gradle project then the process of adding a module is the same as Creating a new Gradle project. If the existing project is a Gradle project, then the process of adding a new module is shorter. You need to specify the name of your module in the ArtifactId field. The rest of the information is added automatically, and you can use either the default settings or change them according to your preferences. Also, note that Add as module to field, by default, displays the name of your project to which you are trying to add a module. You can click to select a different name if you have other linked Gradle projects.

Convert a regular project into a Gradle project

  1. Open your project in IntelliJ IDEA.
  2. In the Project tool window, right-click the name of your project and select New | File .
  3. In the dialog that opens enter build.gradle and click OK .
  4. Open the build.gradle file in the editor, add the information you need and re-open your project. The following minimal information should be included in the project’s build script file:

plugins < id 'java' >group ‘org.example’ version ‘1.0-SNAPSHOT’ repositories < mavenCentral() >sourceSets < main < java < srcDirs = ['src'] >> > dependencies < compile 'junit:junit:4.12' >

Access the Gradle settings

Use the Gradle settings to configure the build and run actions for each linked Gradle project, a Gradle version, importing of the project’s changes, and so on.

Gradle settings

  1. In the Settings dialog ( Ctrl+Alt+S ) , go to Build, Execution, Deployment| Gradle . Click on the toolbar, in the Gradle tool window to access the Gradle settings.
  2. On the Gradle settings page, configure the available options and click OK to save the changes.

Configure a Gradle version for a project

IntelliJ IDEA lets you use different options to configure a Gradle version for your Gradle project. You can use the default Gradle wrapper, use a Gradle wrapper as a task, or configure a local Gradle distribution.

Gradle settings

  1. Select in the Gradle tool window to quickly access the Gradle settings page.
  2. In the Distribution list select one of the following options:
    • Wrapper : this is a recommended default option that uses Gradle wrapper. In this case you delegate the update of Gradle versions to Gradle and get an automatic Gradle download for the build. This option also lets you build with a precise Gradle version. The Gradle version is saved in the gradle-wrapper.properties file in the gradle directory of your project and helps you eliminate any Gradle version problems.
    • Wrapper task : select this option to configure a Gradle wrapper according to the wrapper task configuration. It might be convenient if you prefer to control which Gradle version to use in the project. If you used the default Gradle wrapper option and then switched to the Gradle wrapper task configuration, changes you made in the task automatically update during the project import.
    • Local installation : select this option if you want to manually download and use a specific Gradle version. Specify the location of your Gradle installation and JVM under which IntelliJ IDEA will run Gradle when you import the specified Gradle project and when you execute its tasks.

Click OK to save the changes.

Add VM options for the Gradle project

You can specify VM options for your Gradle project using the gradle.properties file.

the gradle.properties file

  1. Create or open your Gradle project.
  2. In the Project tool window, right-click the project and from the context menu, select New | File .
  3. In the New File dialog, enter gradle.properties as a filename and click OK .
  4. Open the created file in the editor and add the VM options you need.

For more information, refer to the Gradle documentation.

Increase daemon heap size

You can adjust the existing Gradle daemon heap size for your project using the gradle.properties file.

  1. Create or open your Gradle project.
  2. In the Project tool window, right-click the project and from the context menu, select New | File .
  3. In the New File dialog, enter gradle.properties as a filename and click OK .
  4. Open the created file in the editor and specify the needed daemon size using the org.gradle.jvmargs=(JVM arguments) property. The default size is -Xmx512m «-XX:MaxMetaspaceSize=256m» . Check the following code snippet as a syntax example:

org.gradle.jvmargs=-Xmx4096m

For more information, refer to the Gradle documentation.

Getting Started with Gradle

In this tutorial, we’ll create a Gradle project, will run and test it, and run the executable JAR file using Gradle.

The project used in this tutorial can be found on GitHub.

Step 1. Create a project

Let’s create a Gradle project with Java.

Create a new Gradle Project with IntelliJ IDEA

New project Gradle

  1. On the welcome screen, click New Project .
  2. On the page that opens, let’s specify our project’s name (FizzBuzz) and the location.
  3. Let’s select the Java option, which is what we need for our project and Gradle since we are creating a Gradle project.
  4. IntelliJ IDEA automatically adds a project SDK (JDK) in the JDK field. In our tutorial we use the open JDK 14 version. You can change the selected JDK, IntelliJ IDEA will download the appropriate Gradle version. The only thing you need to have is the internet connection. Let’s leave the default Groovy for Gradle DSL and unselect the Add sample code option since we’re going to add our own code from scratch.
  5. We can use the default information for ArtifactId which basically is the name of our project and leave the default information in the GroupId field. Click Create .

After we’ve created our project, and it finished indexing, let’s see what is inside:

    IntelliJ IDEA creates a project with the build.gradle file including the following code:

plugins < id 'java' >group ‘org.example’ version ‘1.0-SNAPSHOT’ repositories < mavenCentral() >dependencies < testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2' >test < useJUnitPlatform() >

As you can see, IntelliJ IDEA conveniently adds a test dependency. IntelliJ IDEA supports code completion inside the build.gradle file. So, if we decide to add more dependencies, IntelliJ IDEA will quickly locate their names and versions.

  • IntelliJ IDEA also creates the src folder with main and test subdirectories in the Project tool window. Gradle project view
  • IntelliJ IDEA enables the dedicated Gradle tool window with a liked project and its default tasks. We will use this window to run our tasks. Gradle tool windowIf you closed this window, you can always access it from the main menu by selecting View | Tool Windows | Gradle .
  • The Gradle settings in our project are used to store the information about the linked projects, Gradle JVM, and build actions. You can quickly access them from the Gradle tool window (click on the toolbar). the Gradle settingsAs you can see, the build and test actions are delegated to Gradle. Also, the Gradle wrapper was used to determine Gradle for our project.
  • The project structure ( Ctrl+Alt+Shift+S ) contains information about the project’s JDK and a language level used in the project. Project Structure
  • Step 2. Add Java code

    Now let’s create a Java application that outputs the first 100 FizzBuzz numbers.

    Add a Java class to the Gradle project

    Create a new class dialog

    1. In the Project tool window open the src folder.
    2. Click the main directory then right-click the java subdirectory and from the list select New | Package .
    3. In the New Package dialog, let’s enter a name of our package which is com.gradle.tutorial .
    4. Now right-click the package and select New | Java Class .
    5. In the New Java Class dialog specify a name of your Java class and click OK . In our case it is FizzBuzzProcessor .
    6. Add the following code to the main FizzBuzzProcessor class:

    Our application is ready. Now, let’s create the necessary tests for it.

    Create a test class

    1. Open the main class FizzBuzzProcessor in the editor, place the caret at the class name and press Ctrl+Shift+T .
    2. In the dialog that opens, let’s make sure that our testing library is JUnit4 (if you want to use JUnit5 then make sure you have the JUnit5 ) and the destination package is com.gradle.tutorial . We add the name FizzBuzzTest and leave the rest of the default options as is and click OK .
    3. Now open the created test class and add the following code:

    Step 3. Run the application with Gradle

    Let’s quickly run the application to see if it works.

    Run main class from the editor

    1. Open the main class FizzBuzzProcessor in the editor.
    2. In the gutter, click and select Run ‘FizzBuzzProcessor.main()’ . Run application in Gradle
    3. Check the result in the Run tool window. Run tool window

    Step 4. Run tests

    Now, let’s run the test we’ve created.

    Run tests in a Gradle project

    We can run our test from the editor or from the Gradle tool window using the test task. We will use the editor.

    Gradle Run test from the gutter

    • Click in the gutter of the editor.

    The result of the test will be displayed in the Run tool window.

    Run tool window /test passed

    If we change the default number in one of the tests, it will fail.

    Run tool window / test failed

    As you can see, the Run tool window displays information obout the failed test including the specific line of the code where the error occurred.

    Step 5. Create an executable JAR file

    Now let’s build our application to create an executable JAR file.

    1. In the Project tool window, double-click the build.gradle file to open it in the editor.
    2. Add the following code:

  • Click in the editor to load the changes to your project.
  • In the Gradle tool window, open the project’s node, then the Tasks node and double-click the build task to run it. Gradle tool window: build taskIntelliJ IDEA creates the build directory that contains our JAR file. Project tool window: build directoryYou can run the created JAR file in the command line with java -jar command.
  • Check the Run tool window for the results. Run tool window: build taskNote that the build task includes the test task that Gradle executes. So, if we make a mistake in one of our tests, the test task will fail and the build task will fail as well. Run tool window: build with failed test
  • Step 6. Run the JAR file with Gradle

    Now let’s tweak the build.gradle file a little bit more, so we can execute our JAR file in the Run anything window.

    Run the JAR file

    1. In the Project tool window, double-click the build.gradle file to open it in the editor.
    2. Let’s add id ‘application’ to the plugins section and the following code:

    application < mainClassName = 'com.gradle.tutorial.FizzBuzzProcessor' >

  • Click in the editor to load the changes to your project.
  • In the Gradle tool window, open the project’s node, then the Tasks node. We can see that Gradle added the distribution node. Open the node and double-click the assembleDist task to run it. If we check the build directory now, we’ll see that IntelliJ IDEA created additional directories. Project tool window: build directory
  • In the Gradle tool window, click on the toolbar.
  • In the window that opens, enter the gradlew run command. Run anything: gradlew runWe should have the same result as when we ran the application in the IntelliJ IDEA editor. Run tool window: run task outputAlternatively, you can execute the run task under the application node. Gradle tool window: run task
  • Добавить комментарий

    Ваш адрес email не будет опубликован. Обязательные поля помечены *