What's the way I can link or use classes from a java gradle project in a new java gradle project?

I don’t know what I’m doing incorrectly, because in my new java project I include the following methods in settings.gradle file

include ":genericname"
project(":genericname").projectDir = file("../path_of_the_project")

And later I added to my build.gradle file the following

implementation project(":genericname")

Also I link the existing project with Gradle tab in IntelliJ to this new project. But still getting:

Cannot resolve symbol ‘GenericClass’

Whenever I want to import it to a new java class in the new project. Don’t know if I get my point but the idea is simple use a gradle project into another new one.

This is where I’m basing my project

That link is an extremely bad advice and definitely nothing you should ever try to do. include is for projects of a multi-project build. If you want to depend on artifacts another build is producing, then use composite builds (includeBuild and a dependency on the coordinates of the artifact).

Hello Kautler, what I’m trying to do is using or utilizing and existing Test Selenium Project that uses TestNG library and use the classes that I’ve got inside src/test/java into a different project, like creating a framework or template for Selenium Tests.

I recently saw this in a Maven project with this configuration in it’s pom.xml file

<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>Application-Core</groupId>
	<artifactId>Application-Core</artifactId>
	<version>0.0.1-SNAPSHOT</version>

Kautler is my lastname. :wink:

If that projects only purpose is to provide those test classes, they should be in src/main/java. Classes in src/test/java are for executing tests, e. g. to test classes in src/main/java. Classes in src/main/java are for publication and consumption by other projects.

Thank you Björn, I think that I will move my tests with Selenium into src/main/java instead of src/test/java to be able to use in other projects. Now the only problem it’s that doesn’t run my testng.xml files