Skip to content

Instantly share code, notes, and snippets.

@tigawa
Created April 9, 2017 13:25
Show Gist options
  • Save tigawa/c8d9b4ef639522d5316d43573d048d41 to your computer and use it in GitHub Desktop.
Save tigawa/c8d9b4ef639522d5316d43573d048d41 to your computer and use it in GitHub Desktop.
buildscript {
ext {
springBootVersion = '1.5.2.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
/* ここ追加 */
plugins {
id "com.moowork.node" version "0.13"
}
/* ここ追加 */
node {
workDir = file("${project.projectDir}/src/main/frontend") //package.jsonがあるディレクトリの位置を指定
nodeModulesDir = file("${project.projectDir}/src/main/frontend") //node_modulesがあるディレクトリの位置を指定
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('org.postgresql:postgresql')
compileOnly('org.projectlombok:lombok')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
/* ここ追加 */
task jsBuild(type: NpmTask) {
args = ['run', 'build']; //package.jsonで定義するタスクを記述する
}
/* ここ追加 */
task copyStaic(type: Copy) {
from 'src/main/frontend/build'
into 'build/resources/main/static'
}
/* ここ追加 */
classes.dependsOn copyStaic
copyStaic.dependsOn jsBuild
@tigawa
Copy link
Author

tigawa commented Apr 9, 2017

/* ここ追加 */
を追加して、gradle-node-plugin を追加した。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment