Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » junit test through gradle eclipse plugin(misalignment in performing a gradle test and eclipse test)
junit test through gradle eclipse plugin [message #1840400] Wed, 14 April 2021 12:42 Go to next message
Luca Stancapiano is currently offline Luca StancapianoFriend
Messages: 2
Registered: April 2021
Junior Member
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

Re: junit test through gradle eclipse plugin [message #1840403 is a reply to message #1840400] Wed, 14 April 2021 14:19 Go to previous message
Luca Stancapiano is currently offline Luca StancapianoFriend
Messages: 2
Registered: April 2021
Junior Member
The problem seems to be due to the Gradle version. If I go back to the previous version, 6.7.1 the problem is gone
Previous Topic:Java Qualified name not working
Next Topic:Help with calculator program
Goto Forum:
  


Current Time: Fri Apr 26 22:03:37 GMT 2024

Powered by FUDForum. Page generated in 0.03331 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top