我的settings.gradle
rootProject.name = 'rpf'
includeBuild( 'is' )
includeBuild( 'sec' ) {
dependencySubstitution {
substitute module( "com.xenoterracide.rpf:is:0.1.0-SNAPSHOT" ) with project( ":is" )
}
}
build.gradle
plugins {
id 'com.brightsparklabs.gradle.multi-git' version '1.3.0'
}
group 'com.xenoterracide'
version '0.1.0-SNAPSHOT'
multiGitPluginConfig {
repositoriesDir = new File('.')
repositories = [
'entity-api': 'git@bitbucket.org:xenworks/entity-api.git',
'entity-jpa': 'git@bitbucket.org:xenworks/entity-jpa.git',
'util': 'git@bitbucket.org:xenworks/util.git',
]
}
task build {
gradle.includedBuild( 'sec' ).task( ':build' ) // sec is not currently a separate repo
}
这是输出
xeno@Freyja MINGW64 ~/IdeaProjects/rpf (master)
$ ./gradlew build --info
Initialized native services in: C:\Users\xeno\.gradle\native
The client will now receive all logging from the daemon (pid: 14968). The daemon log file: C:\Users\xeno\.gradle\daemon\4.4\daemon-14968.out.log
Starting 297th build in daemon [uptime: 3 hrs 34 mins 24.533 secs, performance: 100%, no major garbage collections]
Using 4 worker leases.
Creating new cache for fileHashes, path C:\Users\xeno\IdeaProjects\rpf\.gradle\4.4\fileHashes\fileHashes.bin, access org.gradle.cache.internal.DefaultCacheAccess@2668d8c
Starting Build
[composite-build] Configuring build: C:\Users\xeno\IdeaProjects\rpf\is
> Configure project :is
Evaluating project ':is' using build file 'C:\Users\xeno\IdeaProjects\rpf\is\build.gradle'.
Creating new cache for metadata-1.1/results, path C:\Users\xeno\.gradle\caches\transforms-1\metadata-1.1\results.bin, access org.gradle.cache.internal.DefaultCacheAccess@449d02e2
Creating new cache for metadata-2.36/module-metadata, path C:\Users\xeno\.gradle\caches\modules-2\metadata-2.36\module-metadata.bin, access org.gradle.cache.internal.DefaultCacheAccess@6867a4bc
Creating new cache for metadata-2.36/module-artifacts, path C:\Users\xeno\.gradle\caches\modules-2\metadata-2.36\module-artifacts.bin, access org.gradle.cache.internal.DefaultCacheAccess@6867a4bc
Creating new cache for metadata-2.36/module-versions, path C:\Users\xeno\.gradle\caches\modules-2\metadata-2.36\module-versions.bin, access org.gradle.cache.internal.DefaultCacheAccess@6867a4bc
Creating new cache for metadata-2.36/module-artifact, path C:\Users\xeno\.gradle\caches\modules-2\metadata-2.36\module-artifact.bin, access org.gradle.cache.internal.DefaultCacheAccess@6867a4bc
Applying dependency management to configuration 'api' in project 'is'
Applying dependency management to configuration 'apiElements' in project 'is'
Applying dependency management to configuration 'archives' in project 'is'
Applying dependency management to configuration 'compile' in project 'is'
Applying dependency management to configuration 'compileClasspath' in project 'is'
Applying dependency management to configuration 'compileOnly' in project 'is'
Applying dependency management to configuration 'default' in project 'is'
Applying dependency management to configuration 'implementation' in project 'is'
Applying dependency management to configuration 'runtime' in project 'is'
Applying dependency management to configuration 'runtimeClasspath' in project 'is'
Applying dependency management to configuration 'runtimeElements' in project 'is'
Applying dependency management to configuration 'runtimeOnly' in project 'is'
Applying dependency management to configuration 'spotbugs' in project 'is'
Applying dependency management to configuration 'spotbugsPlugins' in project 'is'
Applying dependency management to configuration 'testCompile' in project 'is'
Applying dependency management to configuration 'testCompileClasspath' in project 'is'
Applying dependency management to configuration 'testCompileOnly' in project 'is'
Applying dependency management to configuration 'testImplementation' in project 'is'
Applying dependency management to configuration 'testRuntime' in project 'is'
Applying dependency management to configuration 'testRuntimeClasspath' in project 'is'
Applying dependency management to configuration 'testRuntimeOnly' in project 'is'
Applying dependency management to configuration 'checkstyle' in project 'is'
Registering project :is in composite build. Will substitute for module 'com.xenoterracide.rpf:is'.
Settings evaluated using settings file 'C:\Users\xeno\IdeaProjects\rpf\settings.gradle'.
Projects loaded. Root project using build file 'C:\Users\xeno\IdeaProjects\rpf\build.gradle'.
Included projects: [root project 'rpf']
> Configure project :
Evaluating root project 'rpf' using build file 'C:\Users\xeno\IdeaProjects\rpf\build.gradle'.
Found no composite build substitute for module 'com.brightsparklabs.gradle.multi-git:com.brightsparklabs.gradle.multi-git.gradle.plugin'.
Found no composite build substitute for module 'com.brightsparklabs.gradle.multi-git:com.brightsparklabs.gradle.multi-git.gradle.plugin'.
Found no composite build substitute for module 'gradle.plugin.com.brightsparklabs:gradle-multi-git'.
All projects evaluated.
Selected primary task 'build' from project :
Tasks to be executed: [task ':build']
Creating new cache for resourceHashesCache, path C:\Users\xeno\IdeaProjects\rpf\.gradle\4.4\fileHashes\resourceHashesCache.bin, access org.gradle.cache.internal.DefaultCacheAccess@2668d8c
Invalidating in-memory cache of C:\Users\xeno\IdeaProjects\rpf\.gradle\4.4\fileHashes\resourceHashesCache.bin
Creating new cache for taskHistory, path C:\Users\xeno\IdeaProjects\rpf\.gradle\4.4\taskHistory\taskHistory.bin, access org.gradle.cache.internal.DefaultCacheAccess@696f1bef
Creating new cache for outputFiles, path C:\Users\xeno\IdeaProjects\rpf\.gradle\buildOutputCleanup\outputFiles.bin, access org.gradle.cache.internal.DefaultCacheAccess@780c9a3
:build (Thread[Daemon worker Thread 25,5,main]) started.
> Task :build UP-TO-DATE
Skipping task ':build' as it has no actions.
:build (Thread[Daemon worker Thread 25,5,main]) completed. Took 0.0 secs.
BUILD SUCCESSFUL in 0s
我想我可能已经部分工作了,但它仍然没有构建秒
我将构建任务更改为这样
task build {
dependsOn gradle.includedBuild( 'is' ).task( ':build' )
dependsOn gradle.includedBuild( 'sec' ).task( ':build' )
}
这是输出,问题似乎很明显,出于某种原因,它认为它应该是:sec:is
而不仅仅是:is
,但我还没弄清楚如何解决这个问题
xeno@Freyja MINGW64 ~/IdeaProjects/rpf (master)
$ ./gradlew build --info
Initialized native services in: C:\Users\xeno\.gradle\native
The client will now receive all logging from the daemon (pid: 14968). The daemon log file: C:\Users\xeno\.gradle\daemon\4.4\daemon-14968.out.log
Starting 364th build in daemon [uptime: 4 hrs 4 mins 32.226 secs, performance: 99%, no major garbage collections]
Using 4 worker leases.
Creating new cache for fileHashes, path C:\Users\xeno\IdeaProjects\rpf\.gradle\4.4\fileHashes\fileHashes.bin, access org.gradle.cache.internal.DefaultCacheAccess@42c3b7af
Starting Build
[composite-build] Configuring build: C:\Users\xeno\IdeaProjects\rpf\is
> Configure project :is
Evaluating project ':is' using build file 'C:\Users\xeno\IdeaProjects\rpf\is\build.gradle'.
Creating new cache for metadata-1.1/results, path C:\Users\xeno\.gradle\caches\transforms-1\metadata-1.1\results.bin, access org.gradle.cache.internal.DefaultCacheAccess@664cab31
Creating new cache for metadata-2.36/module-metadata, path C:\Users\xeno\.gradle\caches\modules-2\metadata-2.36\module-metadata.bin, access org.gradle.cache.internal.DefaultCacheAccess@19076773
Creating new cache for metadata-2.36/module-artifacts, path C:\Users\xeno\.gradle\caches\modules-2\metadata-2.36\module-artifacts.bin, access org.gradle.cache.internal.DefaultCacheAccess@19076773
Creating new cache for metadata-2.36/module-versions, path C:\Users\xeno\.gradle\caches\modules-2\metadata-2.36\module-versions.bin, access org.gradle.cache.internal.DefaultCacheAccess@19076773
Creating new cache for metadata-2.36/module-artifact, path C:\Users\xeno\.gradle\caches\modules-2\metadata-2.36\module-artifact.bin, access org.gradle.cache.internal.DefaultCacheAccess@19076773
Applying dependency management to configuration 'api' in project 'is'
Applying dependency management to configuration 'apiElements' in project 'is'
Applying dependency management to configuration 'archives' in project 'is'
Applying dependency management to configuration 'compile' in project 'is'
Applying dependency management to configuration 'compileClasspath' in project 'is'
Applying dependency management to configuration 'compileOnly' in project 'is'
Applying dependency management to configuration 'default' in project 'is'
Applying dependency management to configuration 'implementation' in project 'is'
Applying dependency management to configuration 'runtime' in project 'is'
Applying dependency management to configuration 'runtimeClasspath' in project 'is'
Applying dependency management to configuration 'runtimeElements' in project 'is'
Applying dependency management to configuration 'runtimeOnly' in project 'is'
Applying dependency management to configuration 'spotbugs' in project 'is'
Applying dependency management to configuration 'spotbugsPlugins' in project 'is'
Applying dependency management to configuration 'testCompile' in project 'is'
Applying dependency management to configuration 'testCompileClasspath' in project 'is'
Applying dependency management to configuration 'testCompileOnly' in project 'is'
Applying dependency management to configuration 'testImplementation' in project 'is'
Applying dependency management to configuration 'testRuntime' in project 'is'
Applying dependency management to configuration 'testRuntimeClasspath' in project 'is'
Applying dependency management to configuration 'testRuntimeOnly' in project 'is'
Applying dependency management to configuration 'checkstyle' in project 'is'
Registering project :is in composite build. Will substitute for module 'com.xenoterracide.rpf:is'.
Settings evaluated using settings file 'C:\Users\xeno\IdeaProjects\rpf\settings.gradle'.
Projects loaded. Root project using build file 'C:\Users\xeno\IdeaProjects\rpf\build.gradle'.
Included projects: [root project 'rpf']
> Configure project :
Evaluating root project 'rpf' using build file 'C:\Users\xeno\IdeaProjects\rpf\build.gradle'.
Found no composite build substitute for module 'com.brightsparklabs.gradle.multi-git:com.brightsparklabs.gradle.multi-git.gradle.plugin'.
Found no composite build substitute for module 'com.brightsparklabs.gradle.multi-git:com.brightsparklabs.gradle.multi-git.gradle.plugin'.
Found no composite build substitute for module 'gradle.plugin.com.brightsparklabs:gradle-multi-git'.
All projects evaluated.
Selected primary task 'build' from project :
> Configure project :sec
Evaluating project ':sec' using build file 'C:\Users\xeno\IdeaProjects\rpf\sec\build.gradle'.
Found no composite build substitute for module 'com.github.spotbugs:com.github.spotbugs.gradle.plugin'.
Found no composite build substitute for module 'io.spring.gradle:dependency-management-plugin'.
Found no composite build substitute for module 'com.github.spotbugs:com.github.spotbugs.gradle.plugin'.
Found no composite build substitute for module 'gradle.plugin.com.github.spotbugs:gradlePlugin'.
Found no composite build substitute for module 'com.github.spotbugs:spotbugs'.
Found no composite build substitute for module 'org.ow2.asm:asm'.
Found no composite build substitute for module 'org.ow2.asm:asm-analysis'.
Found no composite build substitute for module 'org.ow2.asm:asm-commons'.
Found no composite build substitute for module 'org.ow2.asm:asm-tree'.
Found no composite build substitute for module 'org.ow2.asm:asm-util'.
Found no composite build substitute for module 'org.ow2.asm:asm-xml'.
Found no composite build substitute for module 'org.apache.bcel:bcel'.
Found no composite build substitute for module 'net.jcip:jcip-annotations'.
Found no composite build substitute for module 'dom4j:dom4j'.
Found no composite build substitute for module 'jaxen:jaxen'.
Found no composite build substitute for module 'commons-lang:commons-lang'.
Found no composite build substitute for module 'com.google.code.findbugs:jFormatString'.
Found no composite build substitute for module 'com.github.spotbugs:spotbugs-annotations'.
Found no composite build substitute for module 'xml-apis:xml-apis'.
Found no composite build substitute for module 'com.google.code.findbugs:jsr305'.
Applying dependency management to configuration 'api' in project 'sec'
Applying dependency management to configuration 'apiElements' in project 'sec'
Applying dependency management to configuration 'archives' in project 'sec'
Applying dependency management to configuration 'compile' in project 'sec'
Applying dependency management to configuration 'compileClasspath' in project 'sec'
Applying dependency management to configuration 'compileOnly' in project 'sec'
Applying dependency management to configuration 'default' in project 'sec'
Applying dependency management to configuration 'implementation' in project 'sec'
Applying dependency management to configuration 'runtime' in project 'sec'
Applying dependency management to configuration 'runtimeClasspath' in project 'sec'
Applying dependency management to configuration 'runtimeElements' in project 'sec'
Applying dependency management to configuration 'runtimeOnly' in project 'sec'
Applying dependency management to configuration 'spotbugs' in project 'sec'
Applying dependency management to configuration 'spotbugsPlugins' in project 'sec'
Applying dependency management to configuration 'testCompile' in project 'sec'
Applying dependency management to configuration 'testCompileClasspath' in project 'sec'
Applying dependency management to configuration 'testCompileOnly' in project 'sec'
Applying dependency management to configuration 'testImplementation' in project 'sec'
Applying dependency management to configuration 'testRuntime' in project 'sec'
Applying dependency management to configuration 'testRuntimeClasspath' in project 'sec'
Applying dependency management to configuration 'testRuntimeOnly' in project 'sec'
Applying dependency management to configuration 'checkstyle' in project 'sec'
Selected primary task ':build' from project :
Creating new cache for annotation-processors, path C:\Users\xeno\IdeaProjects\rpf\sec\.gradle\4.4\fileContent\annotation-processors.bin, access org.gradle.cache.internal.DefaultCacheAccess@283dc88a
Resolving global dependency management for project 'sec'
Found no composite build substitute for module 'com.xenoterracide:bom'.
Found no composite build substitute for module 'io.spring.platform:platform-bom'.
Found no composite build substitute for module 'org.springframework.boot:spring-boot-starter-parent'.
Found no composite build substitute for module 'org.springframework.boot:spring-boot-dependencies'.
Found no composite build substitute for module 'com.fasterxml.jackson:jackson-bom'.
Found no composite build substitute for module 'com.fasterxml.jackson:jackson-parent'.
Found no composite build substitute for module 'com.fasterxml:oss-parent'.
Found no composite build substitute for module 'org.apache.logging.log4j:log4j-bom'.
Found no composite build substitute for module 'org.apache:apache'.
Found no composite build substitute for module 'org.springframework:spring-framework-bom'.
Found no composite build substitute for module 'org.springframework.data:spring-data-releasetrain'.
Found no composite build substitute for module 'org.springframework.data.build:spring-data-build'.
Found no composite build substitute for module 'org.springframework.integration:spring-integration-bom'.
Found no composite build substitute for module 'org.springframework.security:spring-security-bom'.
Found no composite build substitute for module 'org.springframework:spring-web'.
Found no composite build substitute for module 'org.springframework.boot:spring-boot-starter-data-rest'.
Found no composite build substitute for module 'org.eclipse.persistence:javax.persistence'.
Found no composite build substitute for module 'javax.validation:validation-api'.
Found no composite build substitute for module 'org.hibernate:hibernate-validator'.
Found no composite build substitute for module 'org.springframework:spring-core'.
Found no composite build substitute for module 'org.springframework:spring-context'.
Found no composite build substitute for module 'org.springframework.boot:spring-boot-starter-security'.
Found no composite build substitute for module 'org.springframework.data:spring-data-commons'.
Found no composite build substitute for module 'org.springframework.data:spring-data-jpa'.
Found no composite build substitute for module 'org.springframework.security:spring-security-acl'.
Found no composite build substitute for module 'org.springframework:spring-tx'.
Found no composite build substitute for module 'com.xenoterracide:entity-api'.
Found no composite build substitute for module 'com.xenoterracide:entity-jpa'.
Found project 'project :is' as substitute for module 'com.xenoterracide.rpf:is'.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':sec:compileJava'.
> Could not resolve all dependencies for configuration ':sec:detachedConfiguration15'.
> project :sec:is was not found.
这是我如何定义项目依赖项的
dependencies {
compileOnly 'org.springframework:spring-web'
compileOnly 'org.springframework.boot:spring-boot-starter-data-rest'
compileOnly 'org.eclipse.persistence:javax.persistence'
implementation 'javax.validation:validation-api'
implementation 'org.hibernate:hibernate-validator'
implementation 'org.springframework:spring-core'
implementation 'org.springframework:spring-context'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.data:spring-data-commons'
implementation 'org.springframework.data:spring-data-jpa'
implementation 'org.springframework.security:spring-security-acl'
implementation 'org.springframework:spring-tx'
implementation 'com.xenoterracide:entity-api:0.1.0-SNAPSHOT'
implementation 'com.xenoterracide:entity-jpa:0.1.0-SNAPSHOT'
implementation 'com.xenoterracide.rpf:is:0.1.0-SNAPSHOT'
testRuntimeOnly 'com.h2database:h2'
testRuntimeOnly 'org.apache.tomcat.embed:tomcat-embed-el'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa'
testImplementation 'org.apache.commons:commons-lang3'
testImplementation 'nl.jqno.equalsverifier:equalsverifier'
}
如何让Gradle成功为其复合构建运行构建任务?
答案 0 :(得分:0)
我认为在这种情况下你不需要声明dependencySubstitution:
includeBuild( 'sec' ) {
dependencySubstitution {
substitute module( "com.xenoterracide.rpf:is:0.1.0-SNAPSHOT" ) with project( ":is" )
}
}
运行一个最小的例子,
includeBuild( 'sec' )
适用于以下类:正在正确解析以进行编译:sec。