Skip to content

Commit 66d8af1

Browse files
committed
Polish 'Add instruction to setup code in IntelliJ IDEA'
See gh-266
1 parent 1777be2 commit 66d8af1

5 files changed

+27
-19
lines changed

CONTRIBUTING.adoc

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,16 @@ Once imported, you can apply eclipse settings by running:
5858

5959
NOTE: You'll need to close the `spring-javaformat-formatter-eclipse` and `spring-javaformat-formatter-eclipse-runtime` projects following import since they contain rewritten packages that aren't supported by the IDE
6060

61-
=== Importing into IntelliJ IDEA
6261

62+
63+
=== Importing Into IntelliJ IDEA
6364
You can import the code as a maven project into IntelliJ IDEA.
6465

65-
==== Module dependencies
6666

67+
68+
==== Module Dependencies
6769
When IntelliJ IDEA parses `pom.xml`, it automatically creates inter-module dependencies if dependent libraries are coming from other modules within the project.
68-
However, when dependent modules perform repackaging (e.g. `spring-javaformat-formatter-eclipse-runtime` module), the current module cannot resolve all classes by module dependencies because repackaging(shade & binary manipulation) moves around classes.
70+
However, when dependent modules perform repackaging (e.g. `spring-javaformat-formatter-eclipse-runtime` module), the current module cannot resolve all classes by module dependencies because repackaging (shade & binary manipulation) moves around classes.
6971
Therefore, you need to manually update the dependencies from the module to the produced jars.
7072

7173
Following modules perform repackaging.
@@ -75,19 +77,21 @@ Following modules perform repackaging.
7577

7678
Modules that depend on these modules need jar dependencies instead of module dependencies.
7779

78-
===== Setting up jar dependencies
7980

81+
82+
===== Setting up Jar Dependencies
8083
The following steps define jar-based project libraries on IDE and add them to the modules that need jar dependencies.
8184

8285
*Add a jar file-based project library*
8386

8487
* "Project Settings" -> "Libraries"
8588
* Click "+" sign, then select "Java"
86-
* Specify the jar file +
87-
For example, you can specifie the jar file in the target directory(`<PROJECT>/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/target/spring-javaformat-formatter-eclipse-runtime-0.0.28-SNAPSHOT.jar`)
89+
* Specify the jar file
90+
91+
For example, you can specify the jar file in the target directory(`<PROJECT>/spring-javaformat/spring-javaformat-formatter-eclipse-runtime/target/spring-javaformat-formatter-eclipse-runtime-0.0.28-SNAPSHOT.jar`)
8892
or one in the local maven repository(`~/.m2/repository/io/spring/javaformat/spring-javaformat-formatter-eclipse-runtime/0.0.28-SNAPSHOT/spring-javaformat-formatter-eclipse-runtime-0.0.28-SNAPSHOT.jar`).
8993

90-
image::src/asciidoc/images/setup-idea-library.png[Setup IntelliJ IDEA library]
94+
image::.github/images/setup-idea-library.png[Setup IntelliJ IDEA library]
9195

9296
*Add library dependencies to modules*
9397

@@ -97,59 +101,62 @@ image::src/asciidoc/images/setup-idea-library.png[Setup IntelliJ IDEA library]
97101
* "Choose Libraries" and select necessary libraries that have added in the previous step
98102
* Move up the added libraries higher than the module dependencies (or remove the module dependencies)
99103

100-
image::src/asciidoc/images/setup-idea-dependency.png[Setup IntelliJ IDEA Dependencies]
104+
image::.github/images/setup-idea-dependency.png[Setup IntelliJ IDEA Dependencies]
101105

102106

103-
=== Setting up IntelliJ IDEA plugin development
104107

105-
==== Download images
108+
=== Setting up IntelliJ IDEA Plugin Development
106109

110+
111+
==== Download Images
107112
To develop the `spring-javaformat-intellij-idea-plugin` module, you need an IntelliJ IDEA application on your local machine.
108113

109114
* Open the `pom.xml` in `spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-runtime`.
110115
* Check `intellij.binary` and `intellij.source` properties to find out the appropriate IntelliJ IDEA version.
111-
* Download the binary from the url in `intellij.binary`. +
116+
* Download the binary from the url in `intellij.binary`.
112117
(For OSX, replace the `.tar.gz` to `.dmg` to download the image file.)
113118
* Install the image to the local machine
114119
* Download the source files from github specified in `intellij.source` and unzip it.
115120

116-
==== Setup SDK
117121

122+
123+
==== Setup SDK
118124
* Open "Project Structure" - "Platform Settings" - "SDKs"
119125
* Click "+" sign, "Add Intellij Platform Plugin SDK..."
120126
* Specify the installed intellij image. (`/applications/IntelliJ IDEA CE` for OSX)
121127
* On the right panel, "Sourcepath", Click "+" sign, specify unzipped intellij source directory
122128
* Specify "Sandbox Home" directory
123129

124-
image::src/asciidoc/images/setup-idea-plugin-sdk.png[Setup IntelliJ IDEA Plugin SDK]
130+
image::.github/images/setup-idea-plugin-sdk.png[Setup IntelliJ IDEA Plugin SDK]
125131

126132
Please see the https://plugins.jetbrains.com/docs/intellij/setting-up-environment.html[IntelliJ IDEA reference] for how to setup a plugin development in details.
127133

128-
==== Convert to Plugin Module
129134

135+
136+
==== Convert to Plugin Module
130137
The imported `spring-javaformat-intellij-idea-plugin` module is recognized as a java module.
131138
This needs to be converted to a plugin module.
132139

133140
* Open `spring-javaformat-intellij-idea-plugin.iml` in `spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin`
134141
* Change `type="JAVA_MODULE"` to `type="PLUGIN_MODULE"`
135-
+
136-
[indent=0,xml]
142+
143+
[source,xml]
137144
----
138145
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="PLUGIN_MODULE" version="4">
139146
----
140-
+
147+
141148
Reference https://stackoverflow.com/questions/18278440/how-to-import-and-run-existing-plugins-from-intellij-community-edition-repo[how to convert existing module to a plugin module]
142149

143150
* Open "Project Structure" - "Modules"
144151
* Check `spring-javaformat-intellij-idea-plugin` icon turns to a plugin icon
145152
* "Plugin Deployment" - "Path to META-INF/plugin.xml"
146153
* Specify `<PROJECT>spring-javaformat/spring-javaformat-intellij-idea/spring-javaformat-intellij-idea-plugin/src/main/resources`
147154

148-
image::src/asciidoc/images/setup-idea-plugin-module.png[Setup IntelliJ IDEA Plugin Module]
155+
image::.github/images/setup-idea-plugin-module.png[Setup IntelliJ IDEA Plugin Module]
149156

150157

151-
=== Setting up Gradle plugin development
152158

159+
=== Setting up Gradle Plugin Development
153160
`spring-javaformat-gradle-plugin` module is a gradle plugin and requires gradle related classes.
154161

155162
To add gradle classes, convert this module to a gradle project.
@@ -158,6 +165,7 @@ To add gradle classes, convert this module to a gradle project.
158165
* Select "Import Gradle Project"
159166

160167

168+
161169
=== Importing Into Other IDEs
162170
Maven is well supported by most Java IDEs. Refer to your vendor documentation.
163171

0 commit comments

Comments
 (0)