inflearn logo
강의

Khóa học

Chia sẻ kiến thức

Phát triển ứng dụng web dựa trên Spring và JPA

Thiết lập thư viện frontend

M1 mac 에서 gradle로 빌드하시려는 분들께 공유 하고싶어 글을 남겨요!

1612

kootae88

1 câu hỏi đã được viết

1

  1. static/node_module로 package.json에 선언된 의존성을 다운로드 받아야한다

  2. gradle build 시 package.json에 선언된 의존성을 확인하고 다시 다운로드 받아야 한다.

  3. 뭔가 간단하게 끝내고 싶다 !!!

-- 주석이 많아 가독성이 떨어지지만, 한번 읽어보시면 더 도움이 될거라 생각해서 위의 깃헙에 있는 주석 그대로 복사 붙여넣기 합니다. 수정한 부분은 nodeProjectDir 부분과processResources.dependsOn 부분 입니다.

추가로 package.json 도 아래분이 잘 정리 해주셔서 함께 복사 붙여넣기 합니다.(고맙습니다!!)

-인텔리제이 빌드시(gradle로 설정안했을 경우 동작안해요!)

-gradle 탭 누르셔서 npm Task 들어오는지 확인해주세요!

{
  "name": "static",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@yaireo/tagify": "^3.5.1",
    "bootstrap": "^4.4.1",
    "cropper": "^4.1.0",
    "font-awesome": "^4.7.0",
    "jdenticon": "^2.2.0",
    "jquery": "^3.4.1",
    "jquery-cropper": "^1.0.1",
    "mark.js": "^8.11.1",
    "moment": "^2.24.0",
    "summernote": "^0.8.16"
  }
}
plugins {
    id "com.github.node-gradle.node" version "3.5.0"
    id 'org.springframework.boot' version '2.7.5'
    id 'io.spring.dependency-management' version '1.0.15.RELEASE'
    id 'java'
}

group = 'me.studyOlle'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

node {
    // Whether to download and install a specific Node.js version or not
    // If false, it will use the globally installed Node.js
    // If true, it will download node using above parameters
    // Note that npm is bundled with Node.js
    download = true

    // Version of node to download and install (only used if download is true)
    // It will be unpacked in the workDir
    version = "16.14.0"

    // Version of npm to use
    // If specified, installs it in the npmWorkDir
    // If empty, the plugin will use the npm command bundled with Node.js
    npmVersion = ""

    // Version of Yarn to use
    // Any Yarn task first installs Yarn in the yarnWorkDir
    // It uses the specified version if defined and the latest version otherwise (by default)
    yarnVersion = ""

    // Base URL for fetching node distributions
    // Only used if download is true
    // Change it if you want to use a mirror
    // Or set to null if you want to add the repository on your own.
    distBaseUrl = "https://nodejs.org/dist"

    // Specifies whether it is acceptable to communicate with the Node.js repository over an insecure HTTP connection.
    // Only used if download is true
    // Change it to true if you use a mirror that uses HTTP rather than HTTPS
    // Or set to null if you want to use Gradle's default behaviour.
    allowInsecureProtocol = null

    // The npm command executed by the npmInstall task
    // By default it is install but it can be changed to ci
    npmInstallCommand = "install"

    // The directory where Node.js is unpacked (when download is true)
    workDir = file("${project.projectDir}/.gradle/nodejs")

    // The directory where npm is installed (when a specific version is defined)
    npmWorkDir = file("${project.projectDir}/.gradle/npm")

    // The directory where yarn is installed (when a Yarn task is used)
    yarnWorkDir = file("${project.projectDir}/.gradle/yarn")

    // The Node.js project directory location
    // This is where the package.json file and node_modules directory are located
    // By default it is at the root of the current project
    nodeProjectDir = file("${project.projectDir}/src/main/resources/static")

    // Whether the plugin automatically should add the proxy configuration to npm and yarn commands
    // according the proxy configuration defined for Gradle
    // Disable this option if you want to configure the proxy for npm or yarn on your own
    // (in the .npmrc file for instance)
    nodeProxySettings = ProxySettings.SMART
}

dependencies {
    // View Template Engine
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'

    // Security
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.thymeleaf.extras:thymeleaf-extras-springsecurity5'

    //Web
    implementation 'org.springframework.boot:spring-boot-starter-mail'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation group: 'org.springframework.boot', name: 'spring-boot-starter-validation', version: '2.7.5'


    //Persistence
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    runtimeOnly 'com.h2database:h2'
    runtimeOnly 'com.mysql:mysql-connector-j'

    // LomBok
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'

    // Dev
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'


    //Test Implementation
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
}

tasks.named('test') {
    useJUnitPlatform()
}

processResources.dependsOn('npmInstall')

gradle JPA node npm spring spring-boot thymeleaf java

Câu trả lời 1

0

dwook01088452

감사합니다 !

Study 개설하는 로직에 대해서 궁금점이 있습니다.

0

55

1

앱 재시작 후 회원가입

0

103

1

app.host 관련 질문이 있습니다

0

97

1

강의 버전 정보

0

125

1

event, study 참조

0

220

2

비밀번호 변경 로직 질문있습니다.

0

135

1

프로필 수정 처리 merge 질문입니다.

0

108

1

회원가입 성공 후 redirect이동시 권한 질문

0

494

3

HtmlEmailService 개발하다 생긴 의문입니다

0

250

2

postgreSql 연결하여 JPA 를 통해 테이블 생성시 ZONE 테이블 생성에서 에러가 납니다

0

431

2

수업질문 [긴급] 로그인안되는 문제 말씀해주시는 부분 반영해서 최종 질문드립니다

0

261

2

[긴급-재업로드]수업질문 로그인 안 되는 문제

0

236

1

[긴급] 로그인해도 네비게이션 바가 안 바뀌고 있습니다!! 로그인이 안 됩니다 도와주세요

0

277

1

cropper 오류 문제로 질문드립니다..

0

288

2

authentication관련 질문...

0

495

2

모임참가 취소 할때 로직 질문

0

350

3

안녕하세요 기선님 질문이있습니다..

0

229

1

HTML코드 및 강의 중간자료들

0

679

3

springSecurity

0

523

2

버전 질문입니다.

0

302

1

부트스트랩, css

0

354

2

영속성 컨텍스트 질문

0

248

2

다시 강의를 보니 드는생각..

0

352

2

5:50에 나오는 HTML코드는 어디서 찾을 수 있나여?

0

313

1