最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

spring boot - Gradle multi project doesnt implement projects - Stack Overflow

programmeradmin4浏览0评论

i have this spring boot project structure:

root --ui --track settings.gradle build.gradle

in root/settings.gradle:

rootProject.name = 'root'
include 'track', 'ui'

I want to use ui in track:

root/track/build.gradle:

dependencies {
   //other
   implementation project(':ui')
}

root/track/settings.gradle:

rootProject.name = 'track'
    include 'ui'

root/ui/settings.gradle:

rootProject.name = 'ui'

when i tray to build track i get this error:

Could not determine the dependencies of task ':compileJava'.
> Could not resolve all dependencies for configuration ':compileClasspath'.
   > Could not resolve project :ui.
     Required by:
         root project :
      > No matching variant of project :ui was found. The consumer was configured to find a library for use during compile-time, compatible with Java 17, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
          - No variants exist.

ui is basically just a spring boot project which hols the templates for some layout html etc that other modules should use. The way i tried it is what chatGpt suggests.

i have this spring boot project structure:

root --ui --track settings.gradle build.gradle

in root/settings.gradle:

rootProject.name = 'root'
include 'track', 'ui'

I want to use ui in track:

root/track/build.gradle:

dependencies {
   //other
   implementation project(':ui')
}

root/track/settings.gradle:

rootProject.name = 'track'
    include 'ui'

root/ui/settings.gradle:

rootProject.name = 'ui'

when i tray to build track i get this error:

Could not determine the dependencies of task ':compileJava'.
> Could not resolve all dependencies for configuration ':compileClasspath'.
   > Could not resolve project :ui.
     Required by:
         root project :
      > No matching variant of project :ui was found. The consumer was configured to find a library for use during compile-time, compatible with Java 17, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
          - No variants exist.

ui is basically just a spring boot project which hols the templates for some layout html etc that other modules should use. The way i tried it is what chatGpt suggests.

Share Improve this question asked Mar 10 at 12:34 Timo NeskeTimo Neske 71 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 1

There is one one settings.gradle file per multi-module project which sits in the root folder and specifies the subprojects to include. The other settings.gradle files should be removed.

Then the track module should be able to find the ui module to add as a dependency.

发布评论

评论列表(0)

  1. 暂无评论