gpt4 book ai didi

java - 构建两个build.gradle文件,第二个build.gradle的文件路径错误

转载 作者:行者123 更新时间:2023-12-03 05:50:20 26 4
gpt4 key购买 nike

我在两个不同的文件夹中都有一个 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')

当我执行我的后端构建文件时,我也希望我的前端也被执行。事情是我在 buildFile property上的 buildAngular task上收到此错误:
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路径作为输入,有关如何更正该错误的任何想法?

最佳答案

尝试写这个

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

相反,这
buildFile = 'D\\myProject\\workspace-dev\\myProjectFront\\build.gradle'

尝试添加冒号。

关于java - 构建两个build.gradle文件,第二个build.gradle的文件路径错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48189718/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com