question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SpringBoot 2.0.0.BUILD-SNAPSHOT gradle plugin is breaking multi-project dependencies

See original GitHub issue

We encountered an issue about two weeks ago while using SpringBoot 2.0.0 Snapshot. Seems recent changes break multi project dependencies. The line compile project(':somemodule') seems to be validated for project existence but not for setting the classpath. Meaning, if I change somemodule to any text that does not relate to a mobule in my multi module project, it will complain. But nevertheless it does not find the classes that were successfully compiled on the exiting related module.

To make sure it is not related to our specific build I have taken https://github.com/spring-guides/gs-multi-module And converted it to use 2.0.0.BUILD-SNAPSHOT

I am getting the same errors:

:library:compileJava UP-TO-DATE
:library:processResources NO-SOURCE
:library:classes UP-TO-DATE
:library:jar SKIPPED
/Users/yuval/dev/gs-multi-module/complete/application/src/main/java/hello/app/DemoApplication.java:10: error: package hello.service does not exist
import hello.service.Service;
                    ^
/Users/yuval/dev/gs-multi-module/complete/application/src/main/java/hello/app/DemoApplication.java:11: error: package hello.service does not exist
import hello.service.ServiceConfiguration;
                    ^
/Users/yuval/dev/gs-multi-module/complete/application/src/main/java/hello/app/DemoApplication.java:18: error: cannot find symbol
    private final Service service;
                  ^
  symbol:   class Service
  location: class DemoApplication
/Users/yuval/dev/gs-multi-module/complete/application/src/main/java/hello/app/DemoApplication.java:21: error: cannot find symbol
    public DemoApplication(Service service) {
                           ^
  symbol:   class Service
  location: class DemoApplication
/Users/yuval/dev/gs-multi-module/complete/application/src/main/java/hello/app/DemoApplication.java:14: error: cannot find symbol
@Import(ServiceConfiguration.class)
        ^
  symbol: class ServiceConfiguration
5 errors
:application:compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':application:compileJava'.
> Compilation failed; see the compiler error output for details.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

21reactions
hebracommented, Mar 5, 2018

@mrmeisen in your lib project’s build.gradle disable bootJar and re-enable the jar tasks via

bootJar { enabled = false }
jar {enabled = true}
1reaction
wilkinsonacommented, May 16, 2017

It looks like you introduced a bug during the conversion. The library project appears to have the Spring Boot plugin applied to it. By default that disables the jar task in favour of the bootJar task. I would recommend that you only apply the Spring Boot plugin to the project that contains your application. As shown in the guide to which you have linked, other modules should just be configured with dependency management.

In the future, please raise this sort of question on Stack Overflow or Gitter. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gradle Could not resolve org.springframework.boot:spring ...
Your build file does not have the spring boot plugin. apply plugin: 'org.springframework.boot'. Without this the dependency management system is broken for ...
Read more >
Overriding Dependency Versions with Spring Boot
This article explains some of the dependency management tricks that can be used to create libraries and apps that depend on newer versions...
Read more >
Upgrading your build from Gradle 6.x to the latest
Some plugins will break with this new version of Gradle, for example because they use ... Many Gradle builds rely on JCenter for...
Read more >
3 Upgrading from the previous versions 5.2.5
If you have grails plugins as part of multi-project builds you should also replace ... This is described in the Spring Boot Gradle...
Read more >
Log4j – Maven, Ivy, Gradle, and SBT Artifacts
To build with Gradle, add the dependencies listed below to your ... plugins { id 'io.spring.dependency-management' version '1.0.1.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found