en un clic
build-and-test
// Build/test commands, and unit testing key points including BugLog handling guidelines.
// Build/test commands, and unit testing key points including BugLog handling guidelines.
IntelliJ IDEA MCP for Java code analysis, testing, refactoring, and project navigation. Use when: (1) Checking Java compilation errors (get_file_problems is more accurate than LSP for multi-module Maven), (2) Performing rename refactoring across the codebase, (3) Searching code or finding files in the project. Requires IDEA to be running with MCP plugin connected.
Used to start or stop the project's server in development mode via scripts, or run DtAdmin for test cluster O&M operations, or run benchmarks.
| name | build-and-test |
| description | Build/test commands, and unit testing key points including BugLog handling guidelines. |
This skill provides commands and patterns for building and testing the Dongting project.
| Command | Purpose |
|---|---|
mvn clean package -DskipUTs | Full build (skips unit tests) |
mvn clean package -DskipUTs -PminimalDist | Minimal dist (no slf4j/logback) |
mvn clean package -DskipUTs -PaddJRE | Dist with trimmed JRE (jlink) |
mvn clean package -DskipUTs -PminimalDist,addJRE | Minimal dist with trimmed JRE (no slf4j/logback/java.xml) |
mvn clean compile test-compile | Compile with protobuf |
| Command | Purpose |
|---|---|
mvn clean test -Dtick=3 | Run all unit tests, takes about 25 seconds to run. It is recommended to redirect to a temporary file, as the large amount of output will be truncated otherwise. |
mvn -pl module -am test -Dtest=ClassName -Dtick=3 -Dsurefire.failIfNoSpecifiedTests=false | Run single test class |
mvn -pl module -am test -Dtest=ClassName#method -Dtick=3 -Dsurefire.failIfNoSpecifiedTests=false | Run single test method |
Tip: Use -Dtick=3 to increase test stability.
| Command | Purpose |
|---|---|
mvn verify -DskipUTs -Dtick=3 | Run all integration tests, takes about 100 seconds to run. It is recommended to redirect to a temporary file, as the large amount of output will be truncated otherwise. |
mvn -pl it-test -am verify -DskipUTs=true -Dit.test=ClassName -Dtick=3 | Run single integration test |
Note: Package must be completed before running integration tests. After modifying code, always run mvn clean package -DskipUTs first.
Due to the project's complex build process (multiple compilation phases in pom.xml, protobuf compilation), Java LSP may frequently show compilation errors. Use the following approach:
The project uses BugLogExtension to check BugLog state after each test. If BugLog was triggered, the test fails with "BugLog count should be 0".
Reset BugLog only in tests that intentionally trigger error conditions:
TestUtil.updateTimestamp() to simulate time passage (may cause "nanoTime go back")@Test
void testLockExpiration() {
// ... test code ...
TestUtil.updateTimestamp(ts, ts.nanoTime + 100_000_000L, ts.wallClockMillis + 100);
// ... operations that cause Timestamp.refresh() or update() to detect "nanoTime go back" ...
// The time adjustment + subsequent operations trigger BugLog
BugLog.reset();
// ... more test code ...
}
@BeforeEach/@AfterEach/@BeforeAll/@AfterAll - this hides problemsSee project-structure.md for module details.