Skip to content

Commit eff0f4a

Browse files
committed
Reconstruction using kotlin
1 parent 1303c4f commit eff0f4a

File tree

143 files changed

+2426
-4628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+2426
-4628
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@
5454

5555
### 下载运行
5656

57-
下载并解压 [translator-server-1.0.0-beta.1.zip](https://github.com/manerfan/document-translator/releases/download/v1.0.0-beta.1/translator-server-1.0.0-beta.1.zip)
57+
下载并解压 [translator-server-1.1.0-beta.1.zip](https://github.com/manerfan/document-translator/releases/download/v1.1.0-beta.1/translator-server-1.1.0-beta.1.zip)
5858

59-
将百度翻译平台appid及appsecret替换到<code>translator-server-1.0.0-beta.1.conf</code>文件`RUN_ARGS`属性中。
59+
将百度翻译平台appid及appsecret替换到<code>translator-server.conf</code>文件`RUN_ARGS`属性中。
6060

61-
执行 `./translator-server-1.0.0-beta.1.jar`
61+
执行 `./translator-server.jar start`
6262

6363
浏览器访问 http://localhost:8001
6464

@@ -83,7 +83,7 @@
8383
所需环境:
8484

8585
1. JDK 1.8+
86-
2. Gradle 3.5+
86+
2. Gradle 4.2+
8787
3. NodeJS 6.9+
8888

8989
clone源码`git clone https://github.com/manerfan/document-translator.git `
@@ -98,4 +98,15 @@ clone源码`git clone https://github.com/manerfan/document-translator.git `
9898

9999
#### 编译
100100

101-
项目根目录执行`gradle clean :translator-ui:buildUI build`
101+
项目根目录执行`gradle clean :translator-ui:buildUI build -x test`
102+
103+
#### 版本历史
104+
105+
[2018-01-01] v1.1.0-beta.1
106+
1. kotlin重构
107+
108+
[2017-11-05] v1.0.0-beta.1
109+
1. 支持文本翻译
110+
2. 支持文章断句
111+
3. 支持txt、docx、xlsx、pptx文档翻译
112+

build.gradle

Lines changed: 54 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1+
group "com.manerfan.translator"
2+
version "1.0.0"
3+
description "document translator"
4+
15
buildscript {
26
ext {
3-
springBootVersion = '1.5.+'
4-
dependencyManagementVersion = '1.0.+'
7+
kotlin_version = "1.2.10"
8+
springboot_version = "2.0.+"
9+
cglib_version = "3.2.+"
510
}
611

712
repositories {
8-
mavenLocal()
913
maven {
10-
name 'aliyun maven central'
11-
url 'http://maven.aliyun.com/nexus/content/groups/public'
14+
name "aliyun maven central"
15+
url "http://maven.aliyun.com/nexus/content/groups/public"
1216
}
1317
maven {
14-
name 'spring repo milestone'
15-
url 'https://repo.spring.io/milestone'
18+
name "spring repo milestone"
19+
url "https://repo.spring.io/milestone"
1620
}
1721
maven {
18-
name 'spring plugins'
19-
url 'http://repo.spring.io/plugins-release'
22+
name "spring plugins"
23+
url "http://repo.spring.io/plugins-release"
2024
}
21-
// mavenCentral()
22-
// jcenter()
25+
mavenCentral()
26+
jcenter()
2327
}
24-
2528
dependencies {
26-
classpath("io.spring.gradle:dependency-management-plugin:${dependencyManagementVersion}")
27-
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
28-
classpath("io.spring.gradle:propdeps-plugin:0.0.10.RELEASE")
29+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
30+
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
31+
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springboot_version"
2932
}
3033
}
3134

32-
version = '1.0.0'
33-
description = 'document translator'
34-
35-
apply plugin: 'idea'
35+
apply plugin: "idea"
3636

3737
idea {
3838
project {
39-
languageLevel = '1.8'
39+
languageLevel = "1.8"
4040
}
4141
module {
4242
downloadJavadoc = true
@@ -45,90 +45,68 @@ idea {
4545
}
4646

4747
configure(subprojects - project(":translator-ui")) {
48-
group = 'com.manerfan.translator'
48+
apply plugin: "java"
49+
apply plugin: "java-library"
4950

50-
apply plugin: 'java'
51+
apply plugin: "kotlin"
52+
apply plugin: "kotlin-allopen"
53+
apply plugin: "kotlin-spring"
54+
55+
apply plugin: "io.spring.dependency-management"
56+
dependencyManagement {
57+
imports {
58+
mavenBom "org.springframework.boot:spring-boot-dependencies:$springboot_version"
59+
}
60+
}
5161

5262
sourceCompatibility = '1.8'
5363
targetCompatibility = '1.8'
5464

55-
apply plugin: 'propdeps'
56-
apply plugin: 'propdeps-maven'
57-
apply plugin: 'propdeps-idea'
58-
apply plugin: 'propdeps-eclipse'
65+
compileKotlin {
66+
kotlinOptions.jvmTarget = "1.8"
67+
}
68+
compileTestKotlin {
69+
kotlinOptions.jvmTarget = "1.8"
70+
}
5971

6072
repositories {
6173
mavenLocal()
6274
maven {
6375
name 'aliyun maven central'
6476
url 'http://maven.aliyun.com/nexus/content/groups/public'
6577
}
78+
maven {
79+
name 'spring repo milestone'
80+
url 'https://repo.spring.io/milestone'
81+
}
6682
maven {
6783
name 'EBI'
6884
url 'https://www.ebi.ac.uk/intact/maven/nexus/content/repositories/ebi-repo/'
6985
/* for cpdetector */
7086
}
71-
// mavenCentral()
72-
// jcenter()
87+
mavenCentral()
88+
jcenter()
7389
}
7490

7591
configurations {
7692
all*.exclude module: 'spring-boot-starter-tomcat'
7793
all*.exclude module: 'spring-boot-starter-logging'
7894
}
7995

80-
ext {
81-
cglibVersion = '3.2.+'
82-
springCloudVersion = 'Dalston.SR1'
83-
}
84-
85-
apply plugin: "io.spring.dependency-management"
86-
dependencyManagement {
87-
imports {
88-
mavenBom("org.springframework.boot:spring-boot-dependencies:${springBootVersion}")
89-
mavenBom("org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}")
90-
}
91-
}
92-
9396
dependencies {
94-
compile 'org.springframework.boot:spring-boot-devtools'
95-
compile 'org.springframework.boot:spring-boot-starter-log4j2'
96-
97-
compile 'org.springframework.boot:spring-boot-starter-aop'
98-
compile("cglib:cglib-nodep:${cglibVersion}")
99-
100-
compile("com.google.guava:guava:23.2-jre")
97+
implementation 'org.springframework.boot:spring-boot-devtools'
10198

102-
optional("org.springframework.boot:spring-boot-configuration-processor")
103-
testCompile("junit:junit:4.12")
104-
}
105-
106-
compileJava.dependsOn(processResources)
107-
108-
[compileJava, javadoc, compileTestJava]*.options*.encoding = 'UTF-8'
99+
compile 'org.springframework.boot:spring-boot-starter-log4j2'
109100

110-
javadoc {
111-
options {
112-
encoding 'UTF-8'
113-
charSet 'UTF-8'
114-
author true
115-
version true
116-
title 'Spring Boot'
117-
}
118-
}
101+
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
102+
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
103+
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
104+
compile "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:0.20"
119105

120-
test {
121-
forkEvery = 5 // 在fork测试进程中执行测试类的最大数量
122-
maxParallelForks = Runtime.runtime.availableProcessors() / 2 // fork进程最大数量
123-
}
124-
}
106+
compile 'com.google.guava:guava:23.2-jre'
107+
compile "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.2"
125108

126-
task build {
127-
doFirst {
128-
// run :translator-ui:buildUI
109+
testCompile "org.springframework.boot:spring-boot-starter-test"
110+
testCompile "junit:junit:5.+"
129111
}
130112
}
131-
132-
task wrapper(type: Wrapper) {
133-
gradleVersion = '3.5'
134-
}

gradle/wrapper/gradle-wrapper.properties

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)