plugins { id 'java-library' id 'maven-publish' id 'eclipse-wtp' id 'idea' id 'com.diffplug.eclipse.apt' version '3.41.1' } group 'com.eactive' version '4.5.1-SNAPSHOT' def nexusUrl = "https://nexus.eactive.synology.me:8090" def springVersion = "5.3.27" def queryDslVersion = "5.0.0" def hibernateVersion = "5.6.15.Final" def generatedJavaDir = "$buildDir/generated/java" java { toolchain { languageVersion = JavaLanguageVersion.of(8) } } compileJava { options.encoding = 'UTF-8' sourceSets.main.java { srcDir generatedJavaDir } options.generatedSourceOutputDirectory = project.file(generatedJavaDir) aptOptions { processorArgs = [ 'querydsl.generatedAnnotationClass' : 'com.querydsl.core.annotations.Generated' ] } } jar { exclude '**/persistence.xml' } tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } dependencies { // project > properties > Java Compiler > Annoation Processing annotationProcessor "org.projectlombok:lombok:1.18.28", "org.projectlombok:lombok-mapstruct-binding:0.2.0", "org.mapstruct:mapstruct-processor:1.5.5.Final" annotationProcessor "com.querydsl:querydsl-apt:${queryDslVersion}:jpa", "jakarta.persistence:jakarta.persistence-api:2.2.3", "jakarta.annotation:jakarta.annotation-api:1.3.5" api project(':elink-online-core') compileOnly fileTree(dir: 'libs', include: ['*.jar']) api 'commons-collections:commons-collections:3.2.2' api 'org.apache.poi:poi-excelant:3.9' api group: 'org.apache.commons', name: 'commons-pool2', version: '2.11.1' api 'commons-codec:commons-codec:1.15' //api group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.13.1' compileOnly group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.13.1' compileOnly group: 'xalan', name: 'xalan', version: '2.6.0' api 'net.sf.j8583:j8583:1.18.0' // // //삼성페이 penta //api 'com.eactive:scphost:1.0' //api 'com.eactive:xdsp_java:1.0' //api 'com.eactive:jep-4.j18-md:1.0' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' testRuntimeOnly 'com.h2database:h2:2.1.214' testImplementation 'org.springframework.boot:spring-boot-starter-test:2.6.15' testImplementation 'org.junit.platform:junit-platform-suite-api:1.8.2' testImplementation 'org.junit.platform:junit-platform-launcher:1.8.2' //testImplementation files("libs/json-simple-1.1.1-custom-1.2.jar") //testImplementation files("libs/jep-4.j18-md-1.0.jar") testImplementation fileTree(dir: 'libs', include: ['*.jar']) testImplementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.13.1' testImplementation 'junit:junit:4.4' } test { useJUnitPlatform() // TransformEngine/LayoutManager/MessageFactory 는 ApplicationContextProvider 기반의 // JVM 전역 싱글턴이다. 한 JVM 에서 여러 테스트 클래스를 돌리면 마지막에 뜬 스프링 // 컨텍스트가 앞선 컨텍스트를 덮어써서, 뒤 클래스가 앞 클래스의 레이아웃을 보게 된다 // ("cannot create message" 오류). 클래스마다 JVM 을 새로 띄워 격리한다. forkEvery = 1 // 클래스별 JVM 분리로 느려지는 것을 CPU 코어 수만큼 병렬 실행해 상쇄한다. // 포크마다 별도 JVM(=별도 H2 인메모리 DB)이라 서로 간섭하지 않는다. maxParallelForks = Math.max(1, Runtime.runtime.availableProcessors().intdiv(2)) } publishing { repositories { maven { name = 'eactiveRepository' def releasesRepoUrl = "${nexusUrl}/repository/maven-releases/" def snapshotsRepoUrl = "${nexusUrl}/repository/maven-snapshots/" url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl credentials(PasswordCredentials) } } publications { mavenJava(MavenPublication) { from components.java pom { description = "eLink Transformer module" licenses { license { name = "Commercial License" url = "http://eactive.co.kr" } } } } } } task sourcesJar(type: Jar, dependsOn: classes) { archiveClassifier = 'sources' from sourceSets.main.allSource } artifacts { archives sourcesJar } configurations.all { resolutionStrategy { // 동적 버전 탐색을 10분 캐시 cacheDynamicVersionsFor 10, 'minutes' // 변하는 모듈(Changing Module)을 캐시하지 않음 cacheChangingModulesFor 0, 'seconds' } } task settingEclipseEncoding { if (project.file('.settings').exists()) { File f = file('.settings/org.eclipse.core.resources.prefs') f.write('eclipse.preferences.version=1\n') f.append('encoding/=utf-8') } } task initDirs() { file(generatedJavaDir).mkdirs() } eclipse { synchronizationTasks settingEclipseEncoding, initDirs jdt { apt { // generated 된 패스 경로를 .setting/org.eclipse.jdt.apt.core.prefs 의 org.eclipse.jdt.apt.genSrcDir에 적용한다. // project > properties > Java Compiler > Annoation Processing 화면에서 확인 가능하다. genSrcDir = file(generatedJavaDir) } } project { natures = ['org.eclipse.buildship.core.gradleprojectnature', 'org.eclipse.jdt.core.javanature', 'org.eclipse.wst.common.project.facet.core.nature', 'org.eclipse.wst.common.modulecore.ModuleCoreNature', 'org.eclipse.jem.workbench.JavaEMFNature'] buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder' buildCommand 'org.eclipse.wst.validation.validationbuilder' buildCommand 'org.eclipse.wst.common.project.facet.core.builder' buildCommand 'org.eclipse.jdt.core.javabuilder' } }