Skip to content

Commit 3d71770

Browse files
committed
Improve Gradle settings for Eclipse
1 parent 0549f25 commit 3d71770

File tree

2 files changed

+21
-34
lines changed

2 files changed

+21
-34
lines changed

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@ See [Getting started](https://doma.readthedocs.io/en/latest/getting-started/).
77

88
[![Java CI with Gradle](https://github.com/domaframework/getting-started/workflows/Java%20CI%20with%20Gradle/badge.svg)](https://github.com/domaframework/getting-started/actions?query=workflow%3A%22Java+CI+with+Gradle%22)
99

10-
Notice
11-
------
10+
Import into your IDE
11+
---------------------
1212

13-
For Eclipse users, to import this project into Eclipse, adhere to the instructions outlined below.
13+
Import this project into your IDE as a Gradle Project.
14+
This project has been confirmed to work on the following IDEs.
1415

15-
**1. Run the Gradle command:**
16+
- Eclipse 2023-09 (4.29.0)
17+
- IntelliJ IDEA 2023.3.4 (Community Edition)
1618

17-
```sh
18-
$ ./gradlew cleanEclipse eclipse
19-
```
20-
21-
**2. Navigate through the Eclipse menu and select:**
19+
Build
20+
-----
2221

23-
```
24-
File > Import > General > Existing Projects into Workspace
25-
```
22+
You can build this project with Gradle.
2623

27-
It is important not to choose `File > Import > Gradle > Existing Gradle Project`.
24+
```sh
25+
$ ./gradlew build
26+
```

build.gradle.kts

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import com.diffplug.gradle.eclipse.apt.Factorypath
2+
13
plugins {
24
java
35
id("com.diffplug.eclipse.apt") version "3.44.0"
@@ -30,18 +32,6 @@ subprojects {
3032
named("build") {
3133
dependsOn("spotlessApply")
3234
}
33-
34-
named("eclipse") {
35-
doFirst {
36-
val prefs = file(".settings/org.eclipse.buildship.core.prefs")
37-
if(!prefs.exists()){
38-
prefs.appendText("""
39-
connection.project.dir=
40-
eclipse.preferences.version=1
41-
""".trimIndent())
42-
}
43-
}
44-
}
4535
}
4636

4737
dependencies {
@@ -60,23 +50,21 @@ subprojects {
6050
file {
6151
whenMerged {
6252
val classpath = this as org.gradle.plugins.ide.eclipse.model.Classpath
63-
classpath.entries.removeAll {
64-
when (it) {
65-
is org.gradle.plugins.ide.eclipse.model.Output -> it.path == ".apt_generated"
66-
else -> false
67-
}
53+
val folder = org.gradle.plugins.ide.eclipse.model.SourceFolder(".apt_generated", "bin/main")
54+
classpath.entries.add(folder)
55+
val dir = file(folder.path)
56+
if (!dir.exists()) {
57+
dir.mkdir()
6858
}
6959
}
70-
withXml {
71-
val node = asNode()
72-
node.appendNode("classpathentry", mapOf("kind" to "src", "output" to "bin/main", "path" to ".apt_generated"))
73-
}
7460
}
7561
}
7662
project {
7763
buildCommand("org.eclipse.buildship.core.gradleprojectbuilder")
7864
natures("org.eclipse.buildship.core.gradleprojectnature")
7965
}
66+
// Reset all Eclipse settings when "Refresh Gradle Project" is executed
67+
synchronizationTasks("cleanEclipse", "eclipse")
8068
}
8169

8270
spotless {

0 commit comments

Comments
 (0)