I am trying to use a logger in a subproject. The dependency for this is defined in the subprojects { … } space of my parent gradle.build. My settings.gradle includes the subproject containing the below code. The issue is that I am unable to use an dependencies that provide a concrete implementation of any interface, abstract class or just extends a class to add more methods. For example:
In my subproject,
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Abc {
private static final Logger LOGGER = LoggerFactory.getLogger(Abc.class);
public void method1() {
LOGGER.info(“Number of entries found for id {} in system is {} of {} expected”,id, system.size(), systemCount);
//Here, it says that the method info with varargs method parameters is not found and I get an error in this line.
}
}
/*
Actual error reported by gradle build
C:\GIT\dir1\dir2\dir3\src\main\java\com\something\Abc.java:647: error: no suitable method found for info(String,String,int,int)
LOGGER.info(“Number of entries found for id {} in system is {} of {} expected”,id, system.size(), systemCount);;
^
*/
I am using Gradle 3.4 directly without a wrapper. The build.gradle files were generated from maven POMs using gradle init and it works fine with maven. I also double checked to make sure all the dependencies were equivalent to that of maven’s.