TestProject Forum

Unable to build and executable jar file

I was trying to build an executable jar file using the generated code. I am getting this error -
“Main method not found in class io.testproject.generated.tests.abc.xyz, please define the main method as:
public static void main(String args)
or a JavaFX application class must extend javafx.application.Application”

This is my gradle.build file look like -

plugins {
id ‘java’

group ‘ABC.generated’
version ‘1.0’

test {

repositories {
maven {
url “https://oss.sonatype.org/content/repositories/snapshots/

jar {
manifest {
“Main-Class”: ‘io.testproject.generated.tests.abc.xyz’)

// Include compiled test classes and their sources
from sourceSets.test.output+sourceSets.test.allSource

// Collect and zip all classes from both test and runtime configurations
from { configurations.testRuntimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }


compileTestJava.options.compilerArgs.add ‘-parameters’

dependencies {
implementation ‘io.testproject:java-sdk:1.2.3-RELEASE’
// Use JUnit Jupiter API for testing.
testImplementation ‘org.junit.jupiter:junit-jupiter-api:5.6.0’

// Module "junit-jupiter-params" of JUnit 5.
testImplementation   group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.6.0'

// Use JUnit Jupiter Engine for testing.
testImplementation   'org.junit.jupiter:junit-jupiter-engine:5.6.0'


I have followed this steps to generate the code -

Click on the meatballs icon next to the test group > Click on generated code > Choose test project open SDK > Chrome Browser > Click On Download

Changes I made on gradle.build -
Added manifest inside jar block -

manifest {
“Main-Class”: ‘io.testproject.generated.tests.abc.xyz’)

added the following line inside dependencies block -

implementation ‘io.testproject:java-sdk:1.2.3-RELEASE’

I tried compiling the project using both java 15.0.1 SDK and testproject_SDK_0.65.0.jar

Hi @sultan.parvez,
To compile a code that has been downloaded from TestProject into a jar, no changes in the code are required.
The issue that you have encountered is due to java 15.0.1, in order to compile and upload the code you need to use Java 11.
Regarding the dependencies you don’t need add or change anything in your code, it’s already generated with:

implementation 'io.testproject:java-sdk:1.1.0-RELEASE

Meaning both these dependencies are redundant:

implementation ‘io.testproject:java-sdk:1.2.3-RELEASE’

Let me know if you managed.

Thanks @Amit.Lacher for responding, I have downgraded to java 11 and build the jar.

I am still facing this error-

I kept the previously mentioned manifest and removed the redundant dependencies.

Hi @sultan.parvez,
Can you verify that you are complying the project using Java 11, you need to choose it in your IDE.
If you have it downloaded but not selected it will not work.
Also, did you make any other changes other then removing the dependencies to the original package that was downloaded from TestProject?

Hey @Amit.Lacher , Thanks again for reaching out. Yes I am using Java 11 for compiling.

The only changes remains generated code is adding the manifest inside the “jar” block of “build.gradle” .
To make sure there is no other unwanted changes I went ahead and downloaded another copy of the code and build the jar again. Still facing the same issue.

manifest {
attributes ‘Main-Class’: ‘io.testproject.generated.tests.abcgradle.ABCtAutomation’

I tried compiling without the manifest. When I do so I face this error:

no main manifest attribute, inABCGradleABCAutomation-1.0.jar

Hey @sultan.parvez please generate the code again, and without making any changes to the generated code, try to compile it using java 11.
The JAR and Manifest are only required when creating an addon.

Hey @Amit.Lacher Thanks a lot for all the help. I just realized I have to upload the jar file back in the test project i/o to run the test, I was trying to run it from the cli of my local machine.