I'm working with java 16, gradle 7.0 and Eclipse IDE 2021-03 (4.19.0)
Here a simple junit test:
package provagradle;
import org.junit.jupiter.api.Test;
public class Buuuuuuuu {
@Test
public void test() throws Exception {
new Biii();
}
}
Here the class called by junit test:
package provagradle;
import static org.slf4j.LoggerFactory.getLogger;
import org.slf4j.Logger;
public class Biii {
private Logger logger = getLogger(Biii.class);
}
Here the build.gradle configuration file:
apply plugin: 'java'
apply plugin: 'eclipse'
group = 'it.vige'
version = '1.1.5'
sourceCompatibility = 16
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation('org.slf4j:slf4j-simple:1.7.30')
testImplementation('org.junit.jupiter:junit-jupiter-api:5.7.1')
testImplementation('org.junit.jupiter:junit-jupiter-params:5.7.1')
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.7.1')
}
test {
useJUnitPlatform()
testLogging {
events 'passed', 'skipped', 'failed'
}
}
If I run the test through command line through the command:
./gradlew test
it's ok
Now I create the eclipse project through the gradle eclipse with the command:
./gradlew eclipse
I import the project in eclipse. All compile is ok but if I try to run the test through JDT Eclipse I get this error:
https://github.com/flashboss/provagradle/blob/main/error.txt
my conclusion is that the project is not created correctly by the gradle eclipse plugin. If I go to the properties of the project I see that the slf4j is configured only as a module and apparently the test cannot read the library. Where do you think the problem lies?
Here you can find the complete sample https://github.com/flashboss/provagradle
[Updated on: Wed, 14 April 2021 12:58]
Report message to a moderator