How to deploy on Heroku a Gradle Spring Boot app, with dependency on a local Library project?

穿精又带淫゛_ 提交于 2021-01-07 02:16:53

问题


Let's say I have a Gradle Multi project with 2 subprojects, :profile and :commons. :commons is a Library project, and :profile is a Spring Boot app, with details below:

# profile/build.gradle
...
dependencies {
  implementation project(':commons')
  ...
}
...

And

# profile/settings.gradle
rootProject.name = 'profile'
include ":commons"
project(':commons').projectDir = new File('../commons')

Obviously, when I push to Heroku I have the error below:

FAILURE: Build failed with an exception.
remote:        
remote:        * What went wrong:
remote:        Could not determine the dependencies of task ':compileJava'.
remote:        > Could not resolve all task dependencies for configuration ':compileClasspath'.
remote:           > Could not resolve project :commons.
remote:             Required by:
remote:                 project :
remote:              > No matching configuration of project :commons was found. The consumer was configured to find an API of a library compatible with Java 11, preferably in the form of class files, and its dependencies declared externally but:
remote:                  - None of the consumable configurations have attributes. 

How can I include the :commons Library project to Heroku build process ?

Thanks in advance.

Added details

Project hierarchy:

rootApp/
  - commons/
  - profile/
  - settings.gradle

rootApp/settings.gradle

rootProject.name = 'root-app'
include ":profile"
include ":commons"

rootApp/profile/settings.gradle

rootProject.name = 'profile'
include ":commons"
project(':commons').projectDir = new File('../commons')

rootApp/profile/build.gradle

...
evaluationDependsOn(":commons")
dependencies {
  implementation project(':commons')
  ...
}
...

rootApp/commons/settings.gradle

rootProject.name = 'commons'

来源:https://stackoverflow.com/questions/64891154/how-to-deploy-on-heroku-a-gradle-spring-boot-app-with-dependency-on-a-local-lib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!