Scaffold project foundation for ASR event monitor.

Add Maven deps, CN mirrors with DNS workaround, H2 file DB config, and empty package layout from the confirmed solution.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Xin Wang
2026-07-15 21:16:36 +08:00
parent 1d941f7661
commit e6a667bea5
17 changed files with 152 additions and 2 deletions

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
HELP.md
target/
data/
.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

2
.mvn/maven.config Normal file
View File

@@ -0,0 +1,2 @@
-s
.mvn/settings.xml

60
.mvn/settings.xml Normal file
View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
<!-- Prefer Huawei (stable in CN); Aliyun as fallback repo in profile -->
<mirrors>
<mirror>
<id>huaweicloud</id>
<mirrorOf>*</mirrorOf>
<name>Huawei Cloud Maven</name>
<url>https://repo.huaweicloud.com/repository/maven/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>cn-mirrors</id>
<repositories>
<repository>
<id>huaweicloud</id>
<url>https://repo.huaweicloud.com/repository/maven/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>aliyun-public</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>tencent</id>
<url>https://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>huaweicloud</id>
<url>https://repo.huaweicloud.com/repository/maven/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
<pluginRepository>
<id>aliyun-public</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>cn-mirrors</activeProfile>
</activeProfiles>
</settings>

View File

@@ -1,3 +1,3 @@
wrapperVersion=3.3.4
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.16/apache-maven-3.9.16-bin.zip
distributionUrl=https://repo.huaweicloud.com/repository/maven/org/apache/maven/apache-maven/3.9.16/apache-maven-3.9.16-bin.zip

30
mvnw-cn Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Run Maven with Chinese DNS / hosts overrides.
# WSL default nameserver (10.255.255.254) often hangs; this bypasses it.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
REAL_HOME="${HOME}"
DNS_DIR="${TMPDIR:-/tmp}/maven-dns-fix"
mkdir -p "$DNS_DIR"
printf 'nameserver 223.5.5.5\nnameserver 119.29.29.29\noptions timeout:2 attempts:2\n' > "$DNS_DIR/resolv.conf"
cat > "$DNS_DIR/hosts" <<'EOF'
127.0.0.1 localhost
::1 localhost
122.228.195.18 maven.aliyun.com
180.163.142.26 repo.huaweicloud.com
61.170.82.70 mirrors.cloud.tencent.com
EOF
if unshare --user --map-root-user --mount true 2>/dev/null; then
exec unshare --user --map-root-user --mount bash -c "
mount --bind '$DNS_DIR/resolv.conf' /etc/resolv.conf
mount --bind '$DNS_DIR/hosts' /etc/hosts
export HOME='$REAL_HOME'
export MAVEN_OPTS=\"\${MAVEN_OPTS:-} -Dmaven.repo.local=$REAL_HOME/.m2/repository\"
cd '$ROOT'
exec ./mvnw \"\$@\"
" bash "$@"
else
echo "warn: unshare unavailable; running ./mvnw without DNS override" >&2
exec "$ROOT/mvnw" "$@"
fi

19
pom.xml
View File

@@ -42,6 +42,25 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.ahocorasick</groupId>
<artifactId>ahocorasick</artifactId>
<version>0.6.3</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@@ -0,0 +1 @@
package com.example.demo.api;

View File

@@ -0,0 +1 @@
package com.example.demo.application;

View File

@@ -0,0 +1 @@
package com.example.demo.config;

View File

@@ -0,0 +1 @@
package com.example.demo.domain;

View File

@@ -0,0 +1 @@
package com.example.demo.job;

View File

@@ -0,0 +1 @@
package com.example.demo.matcher;

View File

@@ -0,0 +1 @@
package com.example.demo.repository;

View File

@@ -0,0 +1 @@
package com.example.demo.support;

View File

@@ -1 +0,0 @@
spring.application.name=demo

View File

@@ -0,0 +1,31 @@
spring:
application:
name: asr-event-monitor
datasource:
url: jdbc:h2:file:./data/rules;DB_CLOSE_ON_EXIT=FALSE
username: sa
password:
jpa:
hibernate:
ddl-auto: update
open-in-view: false
server:
port: 8080
monitor:
recent-final-window-size: 2
max-processed-seqs: 500
session-ttl: PT2H
session-cleanup-interval: PT10M
management:
endpoints:
web:
exposure:
include:
- health
- info
- metrics

View File