# Gradle

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/ja-jp/help/clion/llms.txt).

> **TL;DR**
> 必須プラグイン  ： [Gradle](https://plugins.jetbrains.com/plugin/13112-gradle)

[Gradle(英語)](https://gradle.org/) は、C/C++ ライブラリとアプリケーションをビルドするためのプラグインを提供するビルド自動化システムです。 CLion では、  cpp-application  および  cpp-library  プラグインに基づく Gradle プロジェクトを操作できます（C/C++ Gradle プラグインの詳細については、このブログ投稿: [新しい C++ プラグインの紹介(英語)](https://blog.gradle.org/introducing-the-new-cpp-plugins)を参照してください）。

CLion での完全に機能する Gradle サポートは開発中です。 フィードバックを共有し、このチケットの更新をフォローすることができます: [CPP-1104(英語)](https://youtrack.jetbrains.com/issue/CPP-1104)

> **Note:**
> Before you start, make sure to [install](managing-plugins.html#install_plugin_from_repo) and enable the [Gradle](https://plugins.jetbrains.com/plugin/13112-gradle) plugin

Procedure: Gradle プロジェクトを開く

1. メインメニューから  `ファイル | オープン`  を選択し、CLion が   build.gradle   ファイルを指すようにします。

2. 開いたダイアログで、   プロジェクトとして開く   をクリックします。

3. CLion will load the project, displaying the progress and status in the   ビルド   tool window:

![開かれた Gradle プロジェクト](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_projectopen.png)

Procedure: プロジェクト設定を調整する

1. `設定 | Build, Execution, Deployment | Build Tools | Gradle`  に進みます。

2. 必要に応じて、プロジェクト設定を構成します。

![Gradle プロジェクト設定](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_settings.png)

詳細については、ダイアログの [リファレンスページ](gradle-settings.html)を参照してください。

## 自動再読み込みを設定する

By default, CLion doesn't reload your project automatically except for the cases of external changes like VCS update. この動作は   ビルドツール   設定で変更できます。

Procedure:

1. `設定 | Build, Execution, Deployment | Build Tools`  に進みます。

2. 自動再読み込みオプションのいずれかを選択します。

![自動再ロードの設定](https://resources.jetbrains.com/help/img/idea/2026.3/cl_autoreload_settings.png)

* 任意の変更 - プロジェクトの再ロードは、 `build.gradle` スクリプトが変更されるとトリガーされます。

* 外部の変更 （デフォルト）- プロジェクトは、VCS 更新などの外部イベントが発生したときにのみ再ロードされます。 その他の変更の場合は、プロジェクトを手動で再ロードする必要があります。 次のいずれかのオプションを使用します。 * エディターに表示されるポップアップをクリックします： ![プロジェクトを再ロードするためのエディターポップアップ](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_reload_popup.png) * ビルド ツールウィンドウで ![Gradle プロジェクトを再ロード](https://resources.jetbrains.com/help/img/idea/2026.3/app.actions.refresh.svg)をクリックします： ![ビルドツールウィンドウからプロジェクトを再読み込みする](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_reimport_syncwindow.png) * Gradle ツールウィンドウで ![Reload All Gradle Projects](https://resources.jetbrains.com/help/img/idea/2026.3/app.actions.refresh.svg)をクリックします： ![Gradle ツールウィンドウからプロジェクトを再読み込み](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_reload_gradlewindow.png)

> **Tip:**
> この設定はプロジェクトごとに機能します。 自動再ロードオプションは、Gradle、 [compilation database](compilation-database.html)、または [Makefile](makefiles-support.html) プロジェクトごとに個別に構成する必要があります。

## Gradle プロジェクトの実行 / デバッグ構成

CLion は、   build.gradle   ファイルから実行 / デバッグ構成を抽出します。 抽出された構成を変更し、  `実行 | 実行 / デバッグ構成の編集`  ダイアログで新しい構成を作成できます。

Gradle プロジェクトで使用できる実行 / デバッグ構成には、 ![](https://resources.jetbrains.com/help/img/idea/2026.3/gradle.icons.gradle.svg) Gradle と ![](https://resources.jetbrains.com/help/img/idea/2026.3/app.runConfigurations.application.svg) Gradle ネイティブアプリケーションの 2 つがあります（後者には [Gradle ネイティブ(英語)](https://plugins.jetbrains.com/plugin/17996-gradle-native)プラグインが必要です）。

Procedure: Gradle 構成をセットアップする

![Gradle 構成設定](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_config_prj.png)

![](https://resources.jetbrains.com/help/img/idea/2026.3/gradle.icons.gradle.svg) Gradle 構成ダイアログで、次の設定を構成します。

* 実行 - 実行するタスクを指定します。 1 つの実行/デバッグ構成で複数のタスクを実行できます。 たとえば、 `clean` と `build` です。 ここで [Gradle コマンドラインパラメーター](https://docs.gradle.org/current/userguide/gradle_command_line.html) を追加することもできます。たとえば、 `--debug` です。

* Gradle プロジェクト - Gradle プロジェクトの場所を指定します。 ![cl_gradle_prjicon.png](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_prjicon.png) をクリックして、登録済みの Gradle プロジェクトのリストから選択します。

> **Tip:**
> 詳細については、 [実行 / デバッグ構成: Gradle](run-debug-gradle.html)を参照してください。

Procedure: Gradle ネイティブアプリケーション構成をセットアップする

> **Note:**
> この構成を使用するには、 [Gradle ネイティブ(英語)](https://plugins.jetbrains.com/plugin/17996-gradle-native)プラグインを追加でインストールする必要があります。

![](https://resources.jetbrains.com/help/img/idea/2026.3/app.runConfigurations.application.svg) Gradle ネイティブアプリケーション設定ダイアログ:

* In the ターゲット​ field, select the desired target from the list: ![Gradle ネイティブアプリケーションのターゲット一覧](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_nativetarget.png)

* In the 実行可能ファイル field, select the proper executable for your configuration.

## Gradle タスクの操作

CLion lets you run Gradle tasks using several different ways such as using a toolbar in the [Gradle tool window](jetgradle-tool-window.html), using a run configuration, and using a context menu.

Procedure: Gradle ツールバーから Gradle タスクを実行する

1. Gradle   ツールウィンドウ（  `表示 | ツールウィンドウ | Gradle`  ）で、ツールバーの ![](https://resources.jetbrains.com/help/img/idea/2026.3/gradle.icons.gradle.svg) をクリックします。

2. 開いている   Gradle タスクを実行   ダイアログで、   コマンドライン   フィールドにタスクの名前を入力し始めます。 CLion displays the list of Gradle tasks from which you can select the appropriate one:

![Gradle タスクの実行](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_runtask.png)

3. CLion runs the selected task and displays the result in the   実行   tool window:

![Gradle タスクの実行](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_runtask2.png)

CLion also saves the task under the   実行構成   node in the   Gradle   window:

![Gradle タスクの実行](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_runtask3.png)

Procedure: コンテキストメニューを使用して Gradle タスクを実行する

* 最初のオプションは、   Gradle プロジェクト   ツールウィンドウの目的のタスクのコンテキストメニューから   実行   を選択することです。

* タスクに対応する実行/デバッグ構成がすでにある場合、コンテキストメニューに   選択   オプションが表示されます。 このオプションを使用してアクティブな構成を設定し、実行できます。

![Gradle タスクの実行](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_runtask4.png)

* タスクに対応する設定がない場合は、コンテキストメニューに   作成   オプションが表示されます。 このオプションを選択して、「実行 / デバッグ構成」ダイアログを開き、選択したタスクで構成を作成します。

* 利用可能なすべての実行 / デバッグ構成が   実行構成   ノードにリストされています。 Use the   実行   option from the context menu to run the tasks presented under this node:

![Gradle タスクの実行](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_runtask6.png)

## Gradle ネイティブアプリケーションの実行

> **Note:**
> Gradle ネイティブアプリケーションを実行するには、 [Gradle ネイティブ(英語)](https://plugins.jetbrains.com/plugin/17996-gradle-native)プラグインを追加でインストールする必要があります。

In CLion, you can [run](running-applications.html) and [debug](debugging-code.html) a Gradle Native application in the same way as a regular application.

例: コードエントリポイントの横にある左のガターの中に ![](https://resources.jetbrains.com/help/img/idea/2026.3/app.actions.execute.svg) アイコンを使用できます。 ![](https://resources.jetbrains.com/help/img/idea/2026.3/app.actions.execute.svg) をクリックして、リストから希望のアクションを選択します。 ターゲットに既存の Gradle ネイティブ構成がない場合は、起動前に新しい構成が作成されます。

![ガターを走らせる](https://resources.jetbrains.com/help/img/idea/2026.3/cl_gradle_rungutter.png)

> **Tip:**
> ![](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.settings.svg) ボタンを使用して、   Gradle   設定ページにすばやくアクセスします。

## 問題と制限

CLion の Gradle サポートの現在の初期段階では、いくつかの既知の問題と機能制限があります。

* CLion は Gradle 用のプロジェクトテンプレートを提供しないため、新規プロジェクトウィザードを使用して新しい Gradle プロジェクトを作成することはできません。

* デバッグ Gradle タスク自体は利用できません。

