Remove pom.xml and RedisClipSync.java files; update README.md to reflect new project structure and build instructions.
This commit is contained in:
68
README.md
68
README.md
@@ -2,23 +2,62 @@
|
||||
|
||||
基于 Redis 的双向剪切板同步:主机将本地剪切板广播到从机,从机将本地剪切板上传到主机并按从机 ID 追加写入 TXT 文件。
|
||||
|
||||
## 构建
|
||||
## 目录结构
|
||||
|
||||
```bash
|
||||
mvn clean package
|
||||
```
|
||||
RedisClipSync/
|
||||
code/ # 代码与构建
|
||||
pom.xml
|
||||
src/main/java/
|
||||
target/ # 打包输出 redis-clip-sync.jar
|
||||
windows/ # Windows 脚本
|
||||
build-and-run.bat # 一键打包并运行
|
||||
run.bat # 仅运行(需已打包)
|
||||
linux/ # Linux 脚本
|
||||
build-and-run.sh # 一键打包并运行
|
||||
run.sh # 仅运行(需已打包)
|
||||
config.master.properties.example
|
||||
config.slave.properties.example
|
||||
config.properties # 运行前从 example 复制并修改
|
||||
README.md
|
||||
剪切板同步.md
|
||||
```
|
||||
|
||||
在 `target/` 下生成 `redis-clip-sync.jar`(已包含 Jedis 依赖,可直接运行)。
|
||||
## 构建与运行
|
||||
|
||||
## 运行
|
||||
### 一键脚本(推荐)
|
||||
|
||||
确保工作目录包含 `config.properties`,或通过参数/系统属性指定配置路径:
|
||||
脚本会从各自目录自动切换到项目根目录再执行,配置与 `clipboard_logs/` 均在根目录。
|
||||
|
||||
**Windows**(在项目根目录或 `windows/` 下执行均可)
|
||||
- **windows/build-and-run.bat**:先打包再启动。
|
||||
双击运行,或:`windows\build-and-run.bat [配置文件路径]`(默认 `config.properties`)。
|
||||
- **windows/run.bat**:不重新打包,直接运行。
|
||||
用法:`windows\run.bat [配置文件路径]`。
|
||||
|
||||
**Linux**(需先赋予执行权限:`chmod +x linux/*.sh`)
|
||||
- **linux/build-and-run.sh**:先打包再启动。
|
||||
`./linux/build-and-run.sh [配置文件路径]`(默认 `config.properties`)。
|
||||
- **linux/run.sh**:不重新打包,直接运行。
|
||||
用法:`./linux/run.sh [配置文件路径]`。
|
||||
|
||||
运行前请将 `config.master.properties.example` 或 `config.slave.properties.example` 复制为 `config.properties` 并修改。
|
||||
|
||||
### 手动构建与运行
|
||||
|
||||
在项目根目录执行:
|
||||
|
||||
```bash
|
||||
java -jar target/redis-clip-sync.jar
|
||||
# 或指定配置
|
||||
java -jar target/redis-clip-sync.jar /path/to/config.properties
|
||||
java -Dconfig=/path/to/config.properties -jar target/redis-clip-sync.jar
|
||||
mvn -f code/pom.xml clean package
|
||||
```
|
||||
|
||||
在 `code/target/` 下生成 `redis-clip-sync.jar`(已包含 Jedis 依赖)。
|
||||
|
||||
确保工作目录为项目根目录并包含 `config.properties`,或通过参数指定配置路径:
|
||||
|
||||
```bash
|
||||
java -jar code/target/redis-clip-sync.jar
|
||||
java -jar code/target/redis-clip-sync.jar /path/to/config.properties
|
||||
```
|
||||
|
||||
## 配置
|
||||
@@ -50,15 +89,14 @@ slave.id=192.168.1.50
|
||||
|
||||
`slave.id` 决定主机端生成的文件名(如 `192.168.1.50.txt`)。
|
||||
|
||||
## 目录结构
|
||||
## 运行目录说明
|
||||
|
||||
主机启动后会自动创建保存目录:
|
||||
主机启动后会在配置的 `master.save.dir`(默认 `./clipboard_logs/`)下自动创建保存目录。建议在项目根目录运行脚本,这样 `config.properties` 与 `clipboard_logs/` 均在根目录下:
|
||||
|
||||
```
|
||||
/
|
||||
- redis-clip-sync.jar
|
||||
RedisClipSync/
|
||||
- config.properties
|
||||
- clipboard_logs/ # 自动创建
|
||||
- clipboard_logs/ # 自动创建(Master)
|
||||
- 192.168.1.50.txt # 从机 A 的记录
|
||||
- 192.168.1.51.txt # 从机 B 的记录
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user