I am creating a multi module project with Spring Boot for deploying my application and using gradle as my build tool.
Now, I am creating independent deployments for some modules in the project. Some of the project requires Embedded tomcat and some do not. All the common dependencies have been put on a common project and all other modules are dependent on this common project.
Most of the other deployment modules require an embedded tomcat application server and other web components (provided by org.springframework.boot', name: 'spring-boot-starter-web) so this has been included in the build.gradle for common project
Here is the build.gradle for common project:
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootVersion compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator', version: springBootVersion compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: springBootVersion compile group: 'org.springframework.data', name: 'spring-data-jpa', version: springDataJpaVersion Now, one of the other modules which is going to be deployed independently does not require this embedded tomcat and other mvc jars which comes with including spring-boot-starter-web but requires the other transitive dependencies from common project. As such, I want to exclude the transitive dependency for
compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootVersion I am doing it like this in the build.gradle other project
dependencies { compile project(':common') { exclude group 'org.springframework.boot', module:'spring-boot-starter-web' } } But while building it is throwing this error:
startup failed: build file '/Users/user1/Documents/repo/storm/build.gradle': 30: expecting '}', found ',' @ line 30, column 44. oup 'org.springframework.boot', module:'
changing it to:
dependencies { compile project(':common'){ exclude group 'org.springframework.boot:spring-boot-starter-web' } } throws:
Could not find method exclude() for arguments [parent-project name] on project ':common'.
How can I exclude transitive dependency here?