Gradle - build spring boot vuejs

Find a suitable project in Github spring-boot-vuejs , Download ready to build. But the original project only had maven configuration, and I wanted to build it with gradle. Online, we found the function of transforming POM of gradle, although it is still an incubation feature:

gradle init --type pom

Executing the above command directly in the root directory of the project will automatically generate relevant files of gradle.

After that, I use the system command to build, not the generated gradlew, and then run the generated jar package:

gradle build
java -jar ./backend/build/libs/backend-0.0.1-SNAPSHOT.jar

Failed to run project successfully:

Picked up _JAVA_OPTIONS:   -Dawt.useSystemAAFontSettings=gasp
There is no main manifest attribute in build/libs/backend-0.0.1-SNAPSHOT.jar

Manually modify build.gradle of backend project:

plugins {
    id 'org.springframework.boot' version '2.1.6.RELEASE'
    id 'java'
}

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

repositories {
    mavenCentral()
}

jar {
    baseName = 'spring-boot-vuejs'
    version =  '0.1.0'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-actuator'
    compile 'org.springframework.boot:spring-boot-starter-web'
    compile 'org.springframework.boot:spring-boot-devtools'
    compile 'org.springframework.boot:spring-boot-starter-data-jpa'
    compile 'com.h2database:h2:1.4.199'
    compile 'org.apache.tomcat:tomcat-jdbc:9.0.21'
    compile 'org.postgresql:postgresql:42.2.5'
    compile 'org.springframework.boot:spring-boot-starter-security'
    testCompile 'org.springframework.boot:spring-boot-starter-test'
    testCompile 'io.rest-assured:rest-assured:4.0.0'
    testCompile 'org.springframework.security:spring-security-test'
}

Build again or fail:

ydx@ydx-PC:$ gradle build
Picked up _JAVA_OPTIONS:   -Dawt.useSystemAAFontSettings=gasp

> Task :backend:compileTestJava FAILED
/home/ydx/Documents/Project/spring_boot/spring-boot-vuejs-master/backend/src/test/java/de/jonashackt/springbootvuejs/controller/BackendControllerTest.java:59: error: cannot access TypeRef
                    .body().as(Long.class);
                           ^
  Can't find io.restassured.common.mapper.TypeRef Class files
1 A mistake

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':backend:compileTestJava'.
> Compilation failed; see the compiler error output for details.

Regardless of the back-end, pound the front-end items. Because npm command will not be called with gradle, execute directly:

npm install

Result node sass was not installed successfully-_-||

It has to be installed manually:

cnpm install --save-dev node-sass

Execute after success:

npm run serve

O(∩ ∩) O hahaha ~, successfully started.

Of course, it's just that the front-end is started, but the back-end is still full of failures.

Tags: Programming Spring Gradle Java npm

Posted on Fri, 01 Nov 2019 04:35:18 -0700 by friday_13