Skip to content

Commit e453b67

Browse files
committed
Add a description about annotation processing
1 parent 9088497 commit e453b67

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

docs/sources/annotation-processing.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ Eclipse
8484

8585
プロジェクトの「Properties」-「Java Compiler」-「Annotation Processing」の項目でオプションを登録します。
8686

87+
IntelliJ IDEA
88+
=============
89+
90+
Preferrences から Build, Execution, Deployment > Compiler > Annotation Processors の画面を開き登録します。
91+
8792
javac
8893
=====
8994

docs/sources/build.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ GroupId と ArtifactId の名称は以下の通りです。
1414
:GroupId: org.seasar.doma
1515
:ArtifactId: doma
1616

17+
.. _eclipse-build:
18+
1719
Eclipse を使ったビルド
1820
======================
1921

@@ -56,6 +58,17 @@ Factory Path の設定
5658

5759
|
5860
61+
IntelliJ IDEA を使ったビルド
62+
================================
63+
64+
IntelliJ IDEA でビルドを行う際のポイントは以下の通りです。
65+
66+
* Module の設定で Inherit project compile output pathを有効にする
67+
* Preferences の設定で注釈処理を有効にする
68+
* 注釈処理で生成されたコードが出力されるディレクトリを Generated Sources Root に設定する
69+
70+
詳細な設定方法については :ref:`idea-annotation-processor` を参照してください。
71+
5972
Gradle を使ったビルド
6073
=====================
6174

docs/sources/getting-started-eclipse.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,14 @@ clone されたディレクトリに移動します。
113113

114114
.. note::
115115

116-
環境変数 ``JAVA_HOME`` に JDK 8 をインストールしたディレクトリを設定しておいてください。
116+
環境変数 ``JAVA_HOME`` に JDK 8 (もしくは JDK 9 や 10)をインストールしたディレクトリを設定しておいてください。
117117
gradlew の実行に必要です。
118118

119+
.. note::
120+
121+
Eclipse 用の設定ファイルには注釈処理の設定が含まれます。
122+
手動で設定する場合は、 :ref:`eclipse-build` を参照ください。
123+
119124

120125
Eclipse のメニューからFile > Import... を実行し
121126
'Existing Projects into Workspace' を選んで simple-boilerplate をインポートします。

docs/sources/getting-started-idea.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,29 @@ IntelliJ IDEA を起動して Import Project を実行し、clone した simple-
4949
.. image:: images/idea-welcome.png
5050
:width: 60 %
5151

52+
|
53+
54+
5255
Import project from external model をチェックし、Gradle を選択します。
5356

5457
.. image:: images/idea-import-project.png
5558
:width: 100 %
5659

60+
|
61+
62+
5763
Use auto import をチェックし、 Create separate module per source set のチェックを外します。最後に Finish を押してください。
5864

5965
.. image:: images/idea-import-project-settings.png
6066
:width: 100 %
6167

68+
|
69+
70+
6271
Build ツールウィンドウに synced successfully というメッセージが表示されればインポートは成功です。
6372

73+
.. _idea-annotation-processor:
74+
6475
Annotation Processor に関する設定
6576
=====================================
6677

@@ -69,12 +80,17 @@ Project ツールウィンドウのコンテキストメニューから Open Mod
6980
.. image:: images/idea-open-module-settings.png
7081
:width: 100 %
7182

83+
|
84+
7285
Modules の Paths の設定画面を開き、Inherit project compile output path が選択されていることを確認してください。
7386
選択されていない場合は選択してください。
7487

7588
.. image:: images/idea-output-path.png
7689
:width: 100 %
7790

91+
|
92+
93+
7894
Preferrences から Build, Execution, Deployment > Compiler > Annotation Processors を開きます。
7995
Enable annotation processing をチェックしてください。
8096
Module content root をチェックしてください。
@@ -84,6 +100,9 @@ Production sources directory には gen/production 、Test sources directory に
84100
.. image:: images/idea-annotation-processors.png
85101
:width: 100 %
86102

103+
|
104+
105+
87106
メニューから Build Project を実行してください。
88107
ビルドにより Annotation Processor により生成されたコードが gen/production に出力されます。
89108
Project ツールウィンドウのコンテキストメニューから Mark Directory as | Generated Sources Root を選択し、

0 commit comments

Comments
 (0)