Skip to content

Commit 2053b93

Browse files
kevinherronclaude
andcommitted
Update dependencies and Maven plugins
- Netty: 4.1.124.Final → 4.1.127.Final - BouncyCastle: 1.81 → 1.82 - JUnit Jupiter: 5.13.4 → 5.14.0 - Checkstyle: 11.0.0 → 11.1.0 - maven-compiler-plugin: 3.14.0 → 3.14.1 - maven-enforcer-plugin: 3.6.1 → 3.6.2 - maven-javadoc-plugin: 3.11.3 → 3.12.0 - versions-maven-plugin: 2.18.0 → 2.19.1 - central-publishing-maven-plugin: 0.8.0 → 0.9.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8804174 commit 2053b93

File tree

2 files changed

+147
-9
lines changed

2 files changed

+147
-9
lines changed

CLAUDE.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this
4+
repository.
5+
6+
## Project Overview
7+
8+
A modern, performant Modbus client and server library for Java 17+, supporting:
9+
10+
- Modbus TCP (with optional TLS/SSL)
11+
- Modbus RTU over Serial
12+
- Modbus RTU over TCP
13+
14+
Published to Maven Central as `com.digitalpetri.modbus`.
15+
16+
## Module Structure
17+
18+
This is a multi-module Maven project with the following modules:
19+
20+
- **modbus** (core): Protocol-agnostic implementation containing:
21+
- PDU definitions for all supported function codes (in `pdu/` package)
22+
- `ModbusClient` and `ModbusServer` abstractions
23+
- PDU serialization/deserialization (`ModbusPduSerializer`)
24+
- Exception handling and function code enums
25+
- Transport abstraction interfaces (`ModbusClientTransport`, `ModbusServerTransport`)
26+
27+
- **modbus-tcp**: Netty-based TCP transport implementations:
28+
- `NettyTcpClientTransport` and `NettyRtuClientTransport` for clients
29+
- `NettyTcpServerTransport` and `NettyRtuServerTransport` for servers
30+
- TLS/SSL support via Netty's SSL handlers
31+
- Uses `netty-channel-fsm` for connection state management
32+
33+
- **modbus-serial**: Serial port transport using jSerialComm library:
34+
- `SerialPortClientTransport` and `SerialPortServerTransport`
35+
- Configuration for baud rate, parity, stop bits, data bits
36+
37+
- **modbus-tests**: Integration tests exercising all transport types
38+
39+
## Build Commands
40+
41+
```bash
42+
# Clean and build all modules
43+
mvn clean install
44+
45+
# Run all tests (including integration tests)
46+
mvn verify
47+
48+
# Run tests for a specific module
49+
mvn test -pl modbus-tcp
50+
51+
# Run a specific test class
52+
mvn test -Dtest=ClientServerIT
53+
54+
# Skip tests during build
55+
mvn clean install -DskipTests
56+
57+
# Check code style
58+
mvn checkstyle:check
59+
60+
# Update dependency/plugin versions (check for updates)
61+
mvn versions:display-dependency-updates
62+
mvn versions:display-plugin-updates
63+
```
64+
65+
## Testing
66+
67+
- Unit tests are in each module's `src/test/java`
68+
- Integration tests (ending with `IT.java`) are in the `modbus-tests` module
69+
- Tests use JUnit 5 (Jupiter)
70+
- Integration tests start real servers and clients to test end-to-end functionality
71+
72+
## Architecture Notes
73+
74+
### Transport Abstraction
75+
76+
The core `modbus` module defines transport interfaces but doesn't implement them. Implementations
77+
are in `modbus-tcp` and `modbus-serial`:
78+
79+
- `ModbusClientTransport<T>` and `ModbusServerTransport<T>` are generic interfaces
80+
- Transport implementations handle framing (MBAP for TCP, RTU for serial)
81+
- Transports are pluggable - new transports can be implemented without modifying core
82+
83+
### Client Architecture
84+
85+
- `ModbusClient` is an abstract base providing synchronous and asynchronous methods for all standard
86+
function codes
87+
- Concrete implementations: `ModbusTcpClient`, `ModbusRtuClient` (TCP module), `ModbusRtuClient` (
88+
serial module)
89+
- Each client wraps a transport and delegates frame sending/receiving
90+
- Both blocking (throws exceptions) and async (returns `CompletionStage`) APIs available
91+
92+
### Server Architecture
93+
94+
- `ModbusServer` interface with `start()`, `stop()`, and `setModbusServices()`
95+
- `ModbusServices` handles incoming requests via service handlers for each function code
96+
- Authorization support via `ModbusServerAuthz` interface in `server.authz` package
97+
- Servers are transport-agnostic and work with any `ModbusServerTransport`
98+
99+
### PDU Layer
100+
101+
- All request/response PDUs in `com.digitalpetri.modbus.pdu` package
102+
- `ModbusPduSerializer` handles encoding/decoding PDUs to/from byte buffers
103+
- PDUs are simple records/classes with validation
104+
- Supports both standard function codes (0x01-0x17) and exception responses
105+
106+
### Netty Integration (TCP)
107+
108+
- Uses Netty 4.x for non-blocking I/O
109+
- `netty-channel-fsm` library manages connection lifecycle as a state machine
110+
- `ModbusTcpCodec` handles MBAP header encoding/decoding
111+
- TLS support via Netty's `SslContext` and `SslHandler`
112+
113+
## Code Style
114+
115+
- Uses Google Java Style Guide
116+
- Enforced via Checkstyle during `verify` phase
117+
- Configuration: `config/checkstyle/checkstyle.xml`
118+
- Build fails on checkstyle violations
119+
120+
## Commit Messages
121+
122+
Keep the title of the commit message to ~72 characters.
123+
124+
Avoid overly verbose descriptions or unnecessary details.
125+
126+
If the commit contains a number of disparate changes, try to generate a brief one-line subject,
127+
then summarize it using bullet points. Avoid subjective justification for changes; state the
128+
change on its own.
129+
130+
## Release Process
131+
132+
Two Maven profiles for publishing to Maven Central:
133+
134+
- `release`: Full release with GPG signing
135+
- `deploy-snapshot`: Snapshot deployment without signing
136+
137+
Releases are tagged as `v{version}` (e.g., `v2.1.3`).

pom.xml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,29 +49,29 @@
4949

5050
<!-- Dependencies -->
5151
<jserialcomm.version>2.11.2</jserialcomm.version>
52-
<netty.version>4.1.124.Final</netty.version>
52+
<netty.version>4.1.127.Final</netty.version>
5353
<netty-channel-fsm.version>1.0.2</netty-channel-fsm.version>
5454
<slf4j.version>2.0.17</slf4j.version>
5555

5656
<!-- Test Dependencies -->
57-
<bouncycastle.version>1.81</bouncycastle.version>
58-
<junit.version>5.13.4</junit.version>
57+
<bouncycastle.version>1.82</bouncycastle.version>
58+
<junit.version>5.14.0</junit.version>
5959

6060
<!-- Plugin Dependencies -->
61-
<central-publishing-maven-plugin.version>0.8.0</central-publishing-maven-plugin.version>
62-
<checkstyle.version>11.0.0</checkstyle.version>
61+
<central-publishing-maven-plugin.version>0.9.0</central-publishing-maven-plugin.version>
62+
<checkstyle.version>11.1.0</checkstyle.version>
6363
<maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
64-
<maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
64+
<maven-compiler-plugin.version>3.14.1</maven-compiler-plugin.version>
6565
<maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
66-
<maven-enforcer-plugin.version>3.6.1</maven-enforcer-plugin.version>
66+
<maven-enforcer-plugin.version>3.6.2</maven-enforcer-plugin.version>
6767
<maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
6868
<maven-install-plugin.version>3.1.4</maven-install-plugin.version>
6969
<maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
70-
<maven-javadoc-plugin.version>3.11.3</maven-javadoc-plugin.version>
70+
<maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
7171
<maven-release-plugin.version>3.1.1</maven-release-plugin.version>
7272
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
7373
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
74-
<versions-maven-plugin.version>2.18.0</versions-maven-plugin.version>
74+
<versions-maven-plugin.version>2.19.1</versions-maven-plugin.version>
7575
</properties>
7676

7777
<dependencyManagement>
@@ -370,6 +370,7 @@
370370
<artifactId>versions-maven-plugin</artifactId>
371371
<version>${versions-maven-plugin.version}</version>
372372
<configuration>
373+
<allowMajorUpdates>false</allowMajorUpdates>
373374
<ruleSet>
374375
<ignoreVersions>
375376
<ignoreVersion>

0 commit comments

Comments
 (0)