plugins { id 'java' id 'application' } // 编码设置 - UTF-8に統一 // タスクの文字エンコーディング設定 tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } tasks.withType(Javadoc) { options.encoding = 'UTF-8' } tasks.withType(Test) { jvmArgs '-Dfile.encoding=UTF-8' } run { jvmArgs '-Dfile.encoding=UTF-8' } group = 'co.jp.techsor.pdf' version = '1.0.0' sourceCompatibility = '17' repositories { mavenCentral() } dependencies { implementation 'com.itextpdf:kernel:8.0.2' implementation 'com.itextpdf:layout:8.0.2' implementation 'commons-cli:commons-cli:1.5.0' testImplementation 'junit:junit:4.13.2' } application { mainClass = 'co.jp.techsor.pdf.App' } jar { manifest { attributes( 'Main-Class': 'co.jp.techsor.pdf.App' ) } from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } duplicatesStrategy = DuplicatesStrategy.EXCLUDE } task fatJar(type: Jar) { archiveBaseName = 'pdf-memo-layers' from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } with jar duplicatesStrategy = DuplicatesStrategy.EXCLUDE } // PDF解析ツール用のJAR task probeJar(type: Jar) { archiveBaseName = 'pdf-probe' manifest { attributes 'Main-Class': 'co.jp.techsor.pdf.PdfProbeApp' } from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } with jar duplicatesStrategy = DuplicatesStrategy.EXCLUDE } // 両方のJARを作成するタスク task allJars { dependsOn fatJar, probeJar } // 图层修复测试タスク task runLayerTest(type: JavaExec) { mainClass = 'co.jp.techsor.pdf.TestLayerFix' classpath = sourceSets.main.runtimeClasspath jvmArgs '-Dfile.encoding=UTF-8' } // 详细图层修复测试タスク task runLayerTestDetailed(type: JavaExec) { mainClass = 'co.jp.techsor.pdf.TestLayerFixDetailed' classpath = sourceSets.main.runtimeClasspath jvmArgs '-Dfile.encoding=UTF-8' }