1. JVM & Maven CLI Tuning
Create a .mvn/ directory in the project root to optimize the runner environment.
.mvn/jvm.config
Optimizes the JVM for short-lived CI tasks by reducing JIT overhead.
-XX:+TieredCompilation
-XX:TieredStopAtLevel=1
-Xverify:none
.mvn/maven.config
Reduces I/O and log storage by suppressing non-essential output.
--batch-mode
-Dorg.slf4j.simpleLogger.defaultLogLevel=warn
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
-Dstyle.color=always
2. Compiler Optimization
Modify the root pom.xml to prevent redundant compilation caused by fresh CI file timestamps.
pom.xml
Add the staleMillis configuration to the maven-compiler-plugin.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<staleMillis>3600000</staleMillis>
</configuration>
</plugin>
3. Parallel Test Execution
Enable concurrent execution for JUnit 5 tests. Place this in src/test/resources/ of the major modules (e.g., dspace-api).
junit-platform.properties
junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.mode.default = concurrent
junit.jupiter.execution.parallel.mode.classes.default = concurrent
Note: For integration tests sharing a database, annotate classes with @execution(ExecutionMode.SAME_THREAD) to avoid race conditions.
4. GitHub Actions Workflow (.github/workflows/build.yml)
Optimize resource usage within the GitHub runner environment.
Artifact Retention
Limit the lifespan of intermediate artifacts to reduce data center storage.
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: compiled-classes
path: "**/target/classes"
retention-days: 1 # Green Tweak: Minimal storage footprint
Conditional Analysis
Execute heavy quality gates only on Pull Requests to save energy on every push.
jobs:
analysis:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- run: mvn sonar:sonar
Summary of Technical Changes
| Feature |
File |
Primary Benefit |
| JIT Optimization |
jvm.config |
Reduced CPU cycles on startup |
| Log Suppression |
maven.config |
Lower I/O and storage energy |
| Incremental Fix |
pom.xml |
Skips redundant recompilation |
| Parallelism |
junit-platform.properties |
Shorter wall-clock time |
| Retention Policy |
build.yml |
Reduced cloud storage waste |
| These changes should result in a leaner, faster, and more sustainable build process for your DSpace fork. |
|
|
1. JVM & Maven CLI Tuning
Create a .mvn/ directory in the project root to optimize the runner environment.
.mvn/jvm.config
Optimizes the JVM for short-lived CI tasks by reducing JIT overhead.
.mvn/maven.config
Reduces I/O and log storage by suppressing non-essential output.
2. Compiler Optimization
Modify the root pom.xml to prevent redundant compilation caused by fresh CI file timestamps.
pom.xml
Add the staleMillis configuration to the maven-compiler-plugin.
3. Parallel Test Execution
Enable concurrent execution for JUnit 5 tests. Place this in src/test/resources/ of the major modules (e.g., dspace-api).
junit-platform.properties
4. GitHub Actions Workflow (.github/workflows/build.yml)
Optimize resource usage within the GitHub runner environment.
Artifact Retention
Limit the lifespan of intermediate artifacts to reduce data center storage.
Conditional Analysis
Execute heavy quality gates only on Pull Requests to save energy on every push.
Summary of Technical Changes