I have converted my maven appium automation to gradle recently. When i try to build using gradle it throws compileTestJava error. But it was working fine while running from Maven. Attached my import, code and error logs as follows. Can somebody please help me on this?
public static Customer getCustomer(String userType) {
Optional customer = CsvFileReader.getCustomerDataFromCsv().stream()
.filter(c -> c.getCustomerType().equals(userType))
.findFirst();
if (customer.isPresent()) {
return customer.get();
} else {
throw new RuntimeException(String.format("Customer %s not found!", userType));
}
}
Error it shows:
/src/test/java/com//pages/AppiumPageObject.java:502: error: cannot find symbol
.filter(c -> c.getCustomerType().equals(userType))
^
symbol: method getCustomerType()
location: variable c of type com.TCS.app.model.Customer
What is com.TCS.app.model.Customer and how does it relate to com.TCS.nlapp.model.Customer?
What is com.TCS.nlapp.utils.CsvFileReader?
Do you maybe have a version conflict that is resolved differently by Gradle (by default higher version wins) than it was resolved by Maven (nearest top-most declaration wins)?
com.TCS.app.model.Customer: I’m importing other package to use their method in my class.Attached my both gradle and POM ,can you check this please? Sorry for long one as I couldn’t attach as attachment.
This is my gradle build.
dependencies {
implementation ‘net.serenity-bdd:serenity-core:2.3.12’
implementation ‘io.cucumber:cucumber-java:6.9.1’
implementation ‘io.cucumber:cucumber-junit:6.9.1’
implementation ‘net.serenity-bdd:serenity-stats:2.3.12’
implementation ‘com.applitools:eyes-appium-java4:4.2.1’
implementation ‘cglib:cglib:3.3.0’
implementation ‘org.apache.commons:commons-lang3:3.8.1’
implementation ‘org.seleniumhq.selenium:selenium-api:3.141.59’
implementation ‘com.fasterxml.jackson.core:jackson-databind:2.13.1’
implementation ‘com.fasterxml.jackson.core:jackson-core:2.13.1’
implementation ‘com.fasterxml.jackson.core:jackson-annotations:2.13.1’
implementation ‘com.opencsv:opencsv:5.1’
implementation ‘com.fasterxml.jackson.dataformat:jackson-dataformat-csv:2.13.1’
implementation ‘org.projectlombok:lombok:1.18.22’
testImplementation ‘net.serenity-bdd:serenity-cucumber6:2.3.12’
testImplementation ‘net.serenity-bdd:serenity-screenplay:2.3.12’
testImplementation ‘net.serenity-bdd:serenity-screenplay-webdriver:2.3.12’
testImplementation ‘net.serenity-bdd:serenity-junit:2.3.12’
testImplementation ‘org.slf4j:slf4j-log4j12:1.7.7’
testImplementation ‘junit:junit:4.13.1’
testImplementation ‘org.assertj:assertj-core:3.6.2’
testImplementation ‘org.hamcrest:hamcrest-all:1.3’
testImplementation ‘com.saucelabs:saucerest:1.0.23’
}
This is my POM
<?xml version="1.0" encoding="UTF-8"?>
4.0.0
com.NL.Mobile
nlAndroidSerenityFramework
1.0.0-SNAPSHOT
jar
That’s fine. As I’m new to forum,I don’t know that. But, at the same time I don’t wanna ask your spare time without money (i thought gradle community is free forum).Somebody will help me if they can.
Of course, that’s why I asked you to do it that way, so it becomes readable.
Just edit your post and add the formatting.
But, at the same time I don’t wanna ask your spare time without money (i thought gradle community is free forum).
That’s the point, it is a free forum where most time just fellow users like me that want to help are answering in their spare time. Asking such people to review 400 lines is well, questionable in my opinion, especially when you got the pointers on how to investigate and at the same time did not provide the information asked for.
A list of dependencies is not too helpful if the class that is complained about is not even part of it.