Skip to content

Commit d084834

Browse files
committed
Remove Makefile, make spotless format and add headers on mvn clean
Signed-off-by: Ricardo Zanini <[email protected]>
1 parent 14ea7e7 commit d084834

File tree

9 files changed

+116
-181
lines changed

9 files changed

+116
-181
lines changed

.githooks/pre-commit

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/maven-verify.yml

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,45 @@ name: sdk-java Verify
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [ main ]
76
pull_request:
8-
branches:
9-
- main
7+
branches: [ main ]
108

119
jobs:
12-
build:
10+
lint:
11+
name: Lint (Spotless + Checkstyle)
1312
runs-on: ubuntu-latest
14-
1513
steps:
16-
# 1. Checkout this repo
1714
- name: Checkout sdk-java
1815
uses: actions/checkout@v4
1916

20-
# 2. Set up JDK 17 for both builds
2117
- name: Set up JDK 17
2218
uses: actions/setup-java@v4
2319
with:
2420
distribution: temurin
2521
java-version: 17
26-
cache: 'maven'
22+
cache: maven
2723

28-
- name: Check formatting
29-
run: |
30-
make ci
24+
- name: Spotless + Checkstyle (fail fast)
25+
run: mvn -B -DskipTests spotless:check checkstyle:check
3126

32-
# 3. Verify the main sdk-java project, excluding the two agentic modules
33-
- name: Verify with Maven
34-
run: |
35-
mvn -B -f pom.xml clean install verify -am
27+
build:
28+
name: Build & Verify
29+
needs: lint
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout sdk-java
33+
uses: actions/checkout@v4
34+
35+
- name: Set up JDK 17
36+
uses: actions/setup-java@v4
37+
with:
38+
distribution: temurin
39+
java-version: 17
40+
cache: maven
3641

37-
# 4. Verify examples
38-
- name: Verify Examples with Maven
42+
- name: Verify with Maven (core)
3943
run: |
40-
mvn -B -f examples/pom.xml clean install verify
44+
mvn -B -f pom.xml clean verify
45+
46+
# TODO: run examples once we fix the close issue

CONTRIBUTING.md

Lines changed: 21 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ Thanks for helping improve this project! This guide explains the local dev setup
66

77
## TL;DR (Fast path)
88

9-
1. **Install prerequisites:** JDK 17+, Maven 3.8+, Git, Make, Bash.
9+
1. **Install prerequisites:** JDK 17+, Maven 3.8+, Git.
1010
2. **Clone** the repo and create a branch: `git checkout -b my-fix`.
11-
3. **Install the repo’s pre-commit hook:** `make hooks` (one-time).
12-
4. **Commit normally.** The pre-commit hook will auto-format Java files and **add license headers**, restage the changes, and let the commit proceed.
13-
5. **Before pushing:** `make check` to run Spotless + Checkstyle locally.
14-
6. **Open a PR** with a clear title and description.
11+
3. **Build locally:** run `mvn clean install` from the repo root. Spotless will **apply formatting and license headers** during the build.
12+
4. **Before pushing:** run `mvn -DskipTests spotless:check checkstyle:check`.
13+
5. **Open a PR** with a clear title and description.
1514

1615
---
1716

@@ -28,17 +27,9 @@ Thanks for helping improve this project! This guide explains the local dev setup
2827
We use **Spotless** (Maven) to:
2928

3029
* Format Java with **google-java-format**.
31-
* Insert/normalize **license headers** from `config/license-header.txt`.
30+
* Insert/normalize **license headers** (the header content is defined **inline** in the parent POM’s `<licenseHeader>` configuration).
3231

33-
> **Do not** hand-format files or hand-edit headers; let Spotless do it. The pre-commit hook runs `spotless:apply` for staged Java files.
34-
35-
Spotless is configured in the **parent POM** and resolves the header file using:
36-
37-
```
38-
${maven.multiModuleProjectDirectory}/config/license-header.txt
39-
```
40-
41-
so children modules pick up the root header correctly.
32+
> **Do not** hand-format files or hand-edit headers; let Spotless do it. Running `mvn clean install` locally will mutate sources to match the standard.
4233
4334
### Checkstyle
4435

@@ -52,46 +43,15 @@ We keep **Checkstyle** to enforce additional rules. CI fails if formatting or st
5243

5344
* **JDK 17+**
5445
* **Maven 3.8+**
55-
* **Git**, **Make**, **Bash**
46+
* **Git**
5647
* Optional IDE plugins:
5748

58-
* IntelliJ: *Google Java Format* plugin (for local editing experience). Spotless remains the source of truth.
59-
60-
### Install the Git Hooks (one-time)
61-
62-
```bash
63-
make hooks
64-
```
65-
66-
This calls `scripts/install-git-hooks.sh` which sets `core.hooksPath` to `.githooks` and marks hooks executable.
67-
68-
### Pre-commit Hook Behavior
69-
70-
* Runs only on **staged** `*.java` files.
71-
* Temporarily stashes unstaged edits (to avoid committing them), runs Spotless, **re-stages** formatted files, then restores the stash.
72-
* If it reformats something, your commit still proceeds with the updated index.
73-
74-
If something goes wrong:
75-
76-
* Run `make format` to apply formatting to the whole repo.
77-
* Stage changes and commit again.
78-
79-
---
80-
81-
## Make Targets
82-
83-
Common tasks are wrapped in a Makefile:
49+
* IntelliJ: *Google Java Format* plugin (for local editing experience). Spotless remains the source of truth.
8450

85-
```text
86-
make hooks # Install/enable repo-local git hooks
87-
make format # Spotless apply (format + license headers)
88-
make check # Spotless check + Checkstyle check
89-
make verify # mvn verify (full build)
90-
make ci # CI checks (Spotless + Checkstyle, no tests)
91-
make clean # mvn clean
92-
```
51+
### Local build & formatting
9352

94-
> If `make` complains about a “missing separator”, ensure each command line under a target starts with a **TAB**.
53+
* Run `mvn clean install` from the repo root. During the build, Spotless **applies** formatting and license headers.
54+
* Before pushing, run `mvn -DskipTests spotless:check checkstyle:check` to ensure CI will pass.
9555

9656
---
9757

@@ -128,10 +88,10 @@ make clean # mvn clean
12888
* Link related issues.
12989
* Check the box:
13090

131-
* [ ] `make check` passes locally
132-
* [ ] Unit/integration tests updated
133-
* [ ] Public API changes documented/Javadoc updated
134-
* [ ] No unrelated formatting churn (Spotless should keep this minimal)
91+
* [ ] `mvn -DskipTests spotless:check checkstyle:check` passes locally
92+
* [ ] Unit/integration tests updated
93+
* [ ] Public API changes documented/Javadoc updated
94+
* [ ] No unrelated formatting churn (Spotless should keep this minimal)
13595

13696
---
13797

@@ -149,24 +109,23 @@ make clean # mvn clean
149109

150110
## License Headers
151111

152-
* Header template lives at: `config/license-header.txt` (root).
153-
* Spotless inserts or normalizes it automatically.
154-
* If the copyright line needs updates, edit the template and run `make format`.
112+
* The license header is defined **inline** in the parent POM under Spotless’ `<licenseHeader>`.
113+
* To update it, edit the parent POM and run `mvn spotless:apply` to propagate changes.
155114

156115
---
157116

158117
## CI
159118

160119
* CI runs `spotless:check` and `checkstyle:check` to ensure consistent formatting and style.
161-
* Builds fail if formatting or headers drift. Run `make format` locally to fix.
120+
* Builds fail if formatting or headers drift. Run `mvn spotless:apply` locally to fix.
162121

163122
---
164123

165124
## Troubleshooting
166125

167-
* **Hook didn’t run?** Did you run `make hooks` after cloning? Check `git config --get core.hooksPath` prints `.githooks`.
168-
* **Header file not found?** Ensure Spotless uses the root path via `${maven.multiModuleProjectDirectory}/config/license-header.txt`.
169-
* **Formatting conflicts with unstaged edits?** The hook stashes them. If a conflict occurs, complete the merge in your working copy, then `git add` and commit again.
126+
* **Spotless changed files during build?** That’s expected locally. Review `git status`, then stage and commit the updates.
127+
* **CI red on formatting?** Run `mvn spotless:apply` locally, commit, and push.
128+
* **Running only a submodule?** Prefer `mvn -pl <module> -am …` from the repo root so parent config (Spotless/Checkstyle) is applied consistently.
170129

171130
---
172131

Makefile

Lines changed: 0 additions & 47 deletions
This file was deleted.

config/license-header.txt

Lines changed: 0 additions & 15 deletions
This file was deleted.

examples/events/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
</parent>
99
<name>Serverless Workflow :: Examples :: Events</name>
1010
<artifactId>serverlessworkflow-examples-events</artifactId>
11+
12+
<properties>
13+
<mainClass>events.EventExample</mainClass>
14+
</properties>
15+
16+
1117
<dependencies>
1218
<dependency>
1319
<groupId>io.serverlessworkflow</groupId>
@@ -18,4 +24,12 @@
1824
<artifactId>slf4j-simple</artifactId>
1925
</dependency>
2026
</dependencies>
27+
<build>
28+
<plugins>
29+
<plugin>
30+
<groupId>org.codehaus.mojo</groupId>
31+
<artifactId>exec-maven-plugin</artifactId>
32+
</plugin>
33+
</plugins>
34+
</build>
2135
</project>

examples/simpleGet/pom.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
</parent>
99
<artifactId>serverlessworkflow-examples-simpleGet</artifactId>
1010
<name>Serverless Workflow :: Examples :: SimpleGet</name>
11+
12+
<properties>
13+
<mainClass>io.serverlessworkflow.impl.BlockingExample</mainClass>
14+
</properties>
15+
1116
<dependencies>
1217
<dependency>
1318
<groupId>io.serverlessworkflow</groupId>
@@ -30,4 +35,15 @@
3035
<artifactId>slf4j-simple</artifactId>
3136
</dependency>
3237
</dependencies>
38+
<build>
39+
<plugins>
40+
<plugin>
41+
<groupId>org.codehaus.mojo</groupId>
42+
<artifactId>exec-maven-plugin</artifactId>
43+
<configuration>
44+
<mainClass>${mainClass}</mainClass>
45+
</configuration>
46+
</plugin>
47+
</plugins>
48+
</build>
3349
</project>

0 commit comments

Comments
 (0)