How do I package java file properly before uploading it to TestProject?

  • 9 Replies
  • 319 Views
Hi Marat,

I have an issue with addon action file upload to TestProject. I tried to export this java file as an ordinary JAR file and as an runnable JAR file but both times when I try to upload this jar file to my newly created addon I get a an error message saying unable to upload file.

How do I package java file properly before uploading it to TestProject addon library?

Regards,

Nemanja
« Last Edit: August 07, 2018, 16:49:46 pm by Marat Strelets »

Re: Re: Using actions in test files
« Reply #1 on: July 30, 2018, 19:56:32 pm »
Are you using Gradle ? Create a JAR task in your Gradle file as described here:
https://github.com/testproject-io/java-sdk-examples/tree/master/Web#packaging

Re: Re: Using actions in test files
« Reply #2 on: July 30, 2018, 20:30:06 pm »
Yes, I'm using Gradle. I can't even upload CleraFields.java action in your web/adon after I export it as a jar file. I'm using your online example so build.gradle file is:

//==============================================
group 'io.testproject'
version '0.1'

apply plugin: 'java'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

// Configurations
configurations {
    tpsdk
    compile.extendsFrom tpsdk
}

// JAR Task
jar {
    archiveName "${rootProject.name}-${version}.jar"
    dependsOn configurations.runtime
    from {
        // Removes TestProject SDK from the final jar file
        (configurations.runtime - configurations.tpsdk).collect {
            it.isDirectory() ? it : zipTree(it)
        }
    }
}

dependencies {
    // Update the location of the sdk as required
    tpsdk files('io.testproject.sdk.java.jar')
}

//==============================================

Re: Re: Using actions in test files
« Reply #3 on: July 30, 2018, 20:32:00 pm »
Can you please attach you JAR file here?

Re: Re: Using actions in test files
« Reply #4 on: July 30, 2018, 20:39:36 pm »
Can you tell me how to upload? There is no upload file button available ...

Re: Re: Using actions in test files
« Reply #5 on: July 30, 2018, 20:41:30 pm »
Can you please upload to a file sharing service such as Google Drive and share a link?


Re: Re: Using actions in test files
« Reply #7 on: July 30, 2018, 20:52:15 pm »
You JAR file contains not only compiled classes but bin, build folders and Gradle configuration files...
Where from (IDE?) and how do you execute the Gradle task? Can you share the Gradle console output?
« Last Edit: July 30, 2018, 20:58:49 pm by Marat Strelets »

Re: Re: Using actions in test files
« Reply #8 on: July 30, 2018, 23:34:23 pm »
I unchecked all the binaries and created new jar file and still I'm not able to upload it:

https://drive.google.com/open?id=1VkWZieVnABC8AJnGmzrD8FMXEpu5817T

I imported three separate Gradle projects: Addon,Runners and Test in eclipse and added project dependencies. I execute my gradle task locally by running runner class which then calls proper test class. This is an example of my run test console output:

23:29:58.520 [main] DEBUG io.testproject.java.sdk.v2.Runner - Starting development session...
23:30:03.590 [main] INFO  io.testproject.java.sdk.v2.Runner - Development session initialized
23:30:03.597 [main] INFO  io.testproject.java.sdk.v2.Runner - Development session connection established via local.rdr.tpagent.io:62943
- word1Stats: ??? 16.300 ????????? (0,37 ???????/?)
- Result1 Value: 16300
- Time1 Value: 0.37
- word1Stats: ??? 128.000 ????????? (0,39 ???????/?)
- Result2 Value: 128000
- Time2 Value: 0.39
- Google TEST - PASS

Re: Re: Using actions in test files
« Reply #9 on: July 31, 2018, 00:05:37 am »
It's great that you can debug locally using Runner and the exported JAR looks much better, but still missing the manifest.json file.
When you bundle resources using Gradle you should put the file under src/main/resources, is that what you did ?
Attached extracted JAR file - there is no manifest.json file in it  :'(

 

Sitemap 1 2 3 4 5 6 7 8