1. build.gradle 설정

buildscript {

ext {

buildVersion = "0.0.1-SNAPSHOT"

springBootVersion = '1.5.8.RELEASE'

}

repositories {

mavenCentral()

}

dependencies {

classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")

}

}


apply plugin: 'java'

apply plugin: 'eclipse'

apply plugin: 'org.springframework.boot'

apply plugin: 'io.spring.dependency-management'


//create a single Jar with all dependencies

jar {

    baseName = "homepage-batch"

    version = "${buildVersion}"

    manifest {

        attributes 'Title': 'Reqeust And Header Tester',

                   'Version': 1.0,

                   'Main-Class': 'com.donzbox.HomepageBatchApplication'

    }

    from {

        configurations.compile.collect {

            it.isDirectory() ? it : zipTree(it)

        }

    }

}



group = 'com.donzbox'

version = '0.0.1-SNAPSHOT'

sourceCompatibility = 1.8


repositories {

mavenCentral()

}


configurations {

providedRuntime

}


dependencies {

runtime("org.springframework.boot:spring-boot-devtools:${springBootVersion}")

compile("org.springframework:springloaded:1.2.8.RELEASE")

testCompile('org.springframework.boot:spring-boot-starter-test')

compileOnly("org.projectlombok:lombok:1.18.6")

annotationProcessor("org.projectlombok:lombok:1.18.6")  <- gradle compile 시 lombok 으로 인한 간섭이 없도록 함

}

test {
    ignoreFailures = true
}


2-1. gradle 빌드 실행 (방법 1)

Working Directory: D:\My Data\WWW\App Source\Batch_Trading

Gradle user home: C:\Users\Donz\.gradle

Gradle Distribution: Gradle wrapper from target build

Gradle Version: 5.2.1

Java Home: C:\Program Files\Java\jdk1.8.0_181

JVM Arguments: None

Program Arguments: None

Build Scans Enabled: false

Offline Mode Enabled: false

Gradle Tasks: clean jar build


> Task :clean

> Task :compileJava

> Task :processResources

> Task :classes

> Task :jar

> Task :findMainClass

> Task :bootRepackage

> Task :assemble

> Task :compileTestJava

> Task :processTestResources NO-SOURCE

> Task :testClasses


> Task :test


com.donzbox.BatchTradingApplicationTests > contextLoads FAILED

    java.lang.IllegalStateException

        Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException

            Caused by: org.springframework.beans.factory.BeanCreationException

                Caused by: java.lang.IllegalArgumentException


1 test completed, 1 failed

There were failing tests. See the report at: file:///D:/My%20Data/WWW/App%20Source/Batch_Trading/build/reports/tests/test/index.html


> Task :check

> Task :build


BUILD SUCCESSFUL in 15s

8 actionable tasks: 8 executed 



2-2. gradle 빌드 실행 (방법 2)




3. clean , jar , build 를 실행

   1) clean  : /homepage-batch/build/libs 디렉토리 비움

   2) jar     : /homepage-batch/build/libs 디렉토리내에 homepage-batch-0.0.1-SNAPSHOT.jar 파일 생성

   3) build : 2)번에서 나온 jar는 실행이 되지 않으므로 build를 수행하여 다음과 같이 파일을 추가로 생성 시킴 (.original 파일이 나옴을 확인해야 함)

-rw-r--r--  1 donz  staff  34056813  4 28 01:27 homepage-batch-0.0.1-SNAPSHOT.jar
-rw-r--r--  1 donz  staff  16724283  4 28 01:26 homepage-batch-0.0.1-SNAPSHOT.jar.original
-rw-r--r--  1 donz  staff  17140592  4 28 01:27 homepage-batch-0.0.1-SNAPSHOT.war
-rw-r--r--  1 donz  staff  15397128  4 28 01:26 homepage-batch-0.0.1-SNAPSHOT.war.original



4. 실행방법


/homepage-batch/build/libs> java -jar homepage-batch-0.0.1-SNAPSHOT.jar --spring.profiles.active=localMac 


SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/Users/donz/Desktop/My_Data/project_e/workspace_bd/workspace_homepage/homepage/homepage-batch/build/libs/homepage-batch-0.0.1-SNAPSHOT.jar!/BOOT-INF/classes!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in [jar:file:/Users/donz/Desktop/My_Data/project_e/workspace_bd/workspace_homepage/homepage/homepage-batch/build/libs/homepage-batch-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]


  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                        


Original Data [0] => CRIX.UPBIT.KRW-BTC, 2018-04-28T01:29:00+09:00 10086000.000000 49054019.112400

Original Data [1] => CRIX.UPBIT.KRW-BTC, 2018-04-28T01:28:00+09:00 10093000.000000 135643767.039290

[C] 2018-04-28T01:29:00+09:00 == [B] Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

taskScheduler-1

^C%                                   

donz@Donzui-MBP /homepage-batch/build/libs> 실행잘됨



+ Recent posts