【问题标题】:Building two build.gradle files, error in file path of the second build.gradle构建两个 build.gradle 文件,第二个 build.gradle 的文件路径出错
【发布时间】:2018-01-10 14:34:06
【问题描述】:

我在两个不同的文件夹中有一个 Angular 前端项目和一个 springboot 后端项目。每个人都有自己的 build.gradle 文件。

他们在这里:

前端:

group 'X'

apply plugin: "com.moowork.node"
apply plugin: "java"

buildscript {
    repositories {
        maven{
            url "https://plugins.gradle.org/m2/"
        }
    }
    dependencies {
        classpath "com.moowork.gradle:gradle-node-plugin:1.2.0"
    }
}

task clientBuild(type: NpmTask) {
    args = ['run', 'build']
}

build.finalizedBy('clientBuild')

后端:

group 'X'

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'

sourceCompatibility = 1.8
targetCompatibility = 1.8

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.7.RELEASE")
    }
}

repositories {
    mavenCentral()
}

dependencies {

    compile("org.springframework.boot:spring-boot-starter-web")

    testCompile group: 'junit', name: 'junit', version: '4.11'
}

jar {
    baseName = 'admin'
    version =  '0.1.0'
}

task buildAngular(type: GradleBuild) {
    buildFile = 'D\\myProject\\workspace-dev\\myProjectFront\\build.gradle'
    tasks = ['build']
}

build.finalizedBy('buildAngular')

当我执行我的后端构建文件时,我希望我的前端也被执行。问题是我在buildAngular task 上的buildFile property 上遇到了这个错误:

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':admin:buildAngular'.
> File 'D:\myProject\workspace-dev\myProjectBack\d\D\myProject\workspace-dev\myProjectFront\                                                                           
build.gradle' specified for property 'buildFile' does not exist.

不知何故,我的路径将“我在 cmd 中的位置”+ buildFile 路径作为输入,您知道如何更正吗?

【问题讨论】:

    标签: java angular spring-boot gradle build.gradle


    【解决方案1】:

    试着写这个

    buildFile = 'D:\\myProject\\workspace-dev\\myProjectFront\\build.gradle'
    

    而不是这个

    buildFile = 'D\\myProject\\workspace-dev\\myProjectFront\\build.gradle'
    

    尝试添加一个冒号。

    【讨论】:

      猜你喜欢
      • 2016-11-10
      • 2020-01-03
      • 2018-10-28
      • 1970-01-01
      • 2016-01-01
      • 2023-03-09
      • 2020-10-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多