Skip to content

Commit

Permalink
Fix java-build.yml and pom.yml in common module
Browse files Browse the repository at this point in the history
  • Loading branch information
helltractor committed Oct 28, 2024
1 parent 9634e8f commit 2d2e934
Show file tree
Hide file tree
Showing 45 changed files with 101 additions and 139 deletions.
1 change: 1 addition & 0 deletions .github/workflows/java-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:

- name: Build with Maven
run: mvn clean install
working-directory: build

- name: Run tests
run: mvn test
Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@
</a>
</p>

# Build container and compile dependencies(in Terminal)

1. `mvn clean compile`
2. `cd ./build`
3. `docker-compose up --d`

# Run application(in IntelliJ IDEA)
# Build application
1. `cd ./build`
2. `docker-compose up --d`
3. `mvn clean package`

# Run application
1. run `ConfigApplication.java`
2. run `TradingEngineApplication.java`
3. run `TradingSequencerApplication.java`
Expand All @@ -45,7 +43,6 @@
8. open `http://localhost:8080` in browser

# Test application

> Mind: More details in [bot](./build/bot/README.md)
# Reference
Expand Down
2 changes: 1 addition & 1 deletion build/bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ bot.py [email protected] --password=password0
batch command:

```
command.py
batch.py
```
6 changes: 1 addition & 5 deletions build/bot/command.py → build/bot/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@

import os

# Python解释器的路径
py_dir = "C:\\Python310\\python.exe"

# 脚本的路径
py_dir = sys.executable
script_dir = f"{os.getcwd()}/bot.py"

# 打开10个命令提示符窗口,并在每个窗口中执行特定的脚本命令
for i in range(10):
command = f'start cmd /k "{py_dir} {script_dir} --email=user{i}@example.com --password=password{i}"'
os.system(command)
8 changes: 4 additions & 4 deletions build/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ services:
zookeeper:
image: bitnami/zookeeper:3.5
user: "root"
container_name: zookeeper
container_name: zookeeper-trade
ports:
- "2181:2181"
environment:
Expand All @@ -14,7 +14,7 @@ services:
kafka:
image: bitnami/kafka:3.0
user: "root"
container_name: kafka
container_name: kafka-trade
ports:
- "9092:9092"
depends_on:
Expand All @@ -31,15 +31,15 @@ services:

redis:
image: redis:6.2
container_name: redis
container_name: redis-trade
ports:
- "6379:6379"
volumes:
- ./docker/redis-data:/data

mysql:
image: mysql:8.0
container_name: mysql
container_name: mysql-trade
ports:
- "3306:3306"
restart: always
Expand Down
23 changes: 16 additions & 7 deletions build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.helltractor.exchange</groupId>
<artifactId>trading-exchange-system</artifactId>
<version>1.0-dev</version>
</parent>

<groupId>com.helltractor.exchange</groupId>
<artifactId>build</artifactId>
<version>1.0-dev</version>
<packaging>pom</packaging>
<name>Trading Exchange System</name>

<modules>
<module>../common</module>
<module>../config</module>
<module>../parent</module>
<module>../push</module>
<module>../quotation</module>
<module>../trading-api</module>
<module>../trading-engine</module>
<module>../trading-sequencer</module>
<module>../ui</module>
</modules>
</project>
26 changes: 6 additions & 20 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

<parent>
<groupId>com.helltractor.exchange</groupId>
<artifactId>trading-exchange-system</artifactId>
<artifactId>parent</artifactId>
<version>1.0-dev</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

<artifactId>common</artifactId>
Expand Down Expand Up @@ -62,25 +63,10 @@
</dependency>

<!-- database driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>

<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
</dependency>
</dependency>
</dependencies>

<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.helltractor.exchange;

import com.helltractor.exchange.database.DataBaseTemplate;
import com.helltractor.exchange.db.DataBaseTemplate;

import java.io.IOException;
import java.nio.file.Files;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void validate() {
throw new ApiException(ApiError.PARAMETER_INVALID, "toUserId", "Must be different with fromUserId.");
}
if (asset == null) {
throw new ApiException(ApiError.PARAMETER_INVALID, "asset", "Must specify asset.");
throw new ApiException(ApiError.PARAMETER_INVALID, "assets", "Must specify assets.");
}
if (amount == null) {
throw new ApiException(ApiError.PARAMETER_INVALID, "amount", "Must specify amount.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.helltractor.exchange.user;
package com.helltractor.exchange.ctx;

import com.helltractor.exchange.api.ApiException;
import com.helltractor.exchange.enums.ApiError;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.helltractor.exchange.database;
package com.helltractor.exchange.db;

import jakarta.persistence.Column;
import jakarta.persistence.GeneratedValue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.helltractor.exchange.database;
package com.helltractor.exchange.db;

import jakarta.persistence.NoResultException;
import jakarta.persistence.NonUniqueResultException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.helltractor.exchange.database;
package com.helltractor.exchange.db;

/**
* Base criteria query.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.helltractor.exchange.database;
package com.helltractor.exchange.db;

import jakarta.persistence.Entity;
import jakarta.persistence.EntityNotFoundException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.helltractor.exchange.database;
package com.helltractor.exchange.db;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.helltractor.exchange.database;
package com.helltractor.exchange.db;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.helltractor.exchange.database;
package com.helltractor.exchange.db;

import jakarta.persistence.Table;
import jakarta.persistence.Transient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.helltractor.exchange.database;
package com.helltractor.exchange.db;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.helltractor.exchange.database;
package com.helltractor.exchange.db;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.helltractor.exchange.database;
package com.helltractor.exchange.db;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class ApiResultMessage extends AbstractMessage {

static final ApiErrorResponse CREATE_ORDER_FAILED = new ApiErrorResponse(ApiError.NO_ENOUGH_ASSET, null,
"No enough available asset");
"No enough available assets");
static final ApiErrorResponse CANCEL_ORDER_FAILED = new ApiErrorResponse(ApiError.ORDER_NOT_FOUND, null,
"Order not found..");
public ApiErrorResponse error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ public class TransferEvent extends AbstractEvent {
public String toString() {
return "TransferEvent [sequenceId=" + sequenceId + ", previousId=" + previousId + ", uniqueId=" + uniqueId
+ ", refId=" + refId + ", createTime=" + createTime + ", fromUserId=" + fromUserId + ", toUserId="
+ toUserId + ", asset=" + asset + ", amount=" + amount + ", sufficient=" + sufficient + "]";
+ toUserId + ", assets=" + asset + ", amount=" + amount + ", sufficient=" + sufficient + "]";
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.helltractor.exchange.support;

import com.helltractor.exchange.database.DataBaseTemplate;
import com.helltractor.exchange.db.DataBaseTemplate;
import org.springframework.beans.factory.annotation.Autowired;

/**
Expand Down
13 changes: 2 additions & 11 deletions config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

<parent>
<groupId>com.helltractor.exchange</groupId>
<artifactId>trading-exchange-system</artifactId>
<artifactId>parent</artifactId>
<version>1.0-dev</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

<artifactId>config</artifactId>
Expand All @@ -18,14 +19,4 @@
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
</dependencies>

<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
15 changes: 2 additions & 13 deletions pom.xml → parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.helltractor.exchange</groupId>
<artifactId>trading-exchange-system</artifactId>
<artifactId>parent</artifactId>
<version>1.0-dev</version>
<packaging>pom</packaging>

Expand All @@ -14,19 +14,8 @@
<version>3.2.0</version>
</parent>

<modules>
<module>build</module>
<module>common</module>
<module>config</module>
<module>push</module>
<module>quotation</module>
<module>trading-api</module>
<module>trading-engine</module>
<module>trading-sequencer</module>
<module>ui</module>
</modules>

<properties>
<project.version>1.0-dev</project.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>21</maven.compiler.source>
Expand Down
5 changes: 2 additions & 3 deletions push/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@

<parent>
<groupId>com.helltractor.exchange</groupId>
<artifactId>trading-exchange-system</artifactId>
<artifactId>parent</artifactId>
<version>1.0-dev</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

<artifactId>push</artifactId>

<dependencies>
<!-- 依赖SpringCloud Config客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>

<!-- 依赖Common模块 -->
<dependency>
<groupId>com.helltractor.exchange</groupId>
<artifactId>common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.helltractor.exchange.push;


import com.helltractor.exchange.redis.RedisCache;
import com.helltractor.exchange.support.LoggerSupport;
import io.vertx.core.Vertx;
Expand Down
6 changes: 3 additions & 3 deletions quotation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,19 @@

<parent>
<groupId>com.helltractor.exchange</groupId>
<artifactId>trading-exchange-system</artifactId>
<artifactId>parent</artifactId>
<version>1.0-dev</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>

<artifactId>quotation</artifactId>

<dependencies>
<!-- 依赖SpringCloud Config客户端 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>

<!-- 依赖Common模块 -->
<dependency>
<groupId>com.helltractor.exchange</groupId>
<artifactId>common</artifactId>
Expand All @@ -28,6 +27,7 @@
</dependencies>

<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.helltractor.exchange.service;
package com.helltractor.exchange;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
Loading

0 comments on commit 2d2e934

Please sign in to comment.