Build jar with Gradle

64 views
Skip to first unread message

GIRISH K S

unread,
Mar 5, 2021, 10:59:13 AM3/5/21
to Gatling User Group
HI,
I need to build a jar using gradle so that i can include this jar as dependency on another project. I have few classes written using gatling, when i try to build jar using gradle.

Generated  Jar has only following files:
META-INF/
META-INF/MANIFEST.MF
pmapi.properties

Below is my project structure
-src
    -gatling
       - resources
            -gatling.conf
        -scala
            - library files   
     -main
        - resources
       -test
         - resources

i am using gatling Gradle plugin:
plugins {
// The following line allows to load io.gatling.gradle plugin and directly apply it
id 'io.gatling.gradle' version '3.5.1'

}

Julius K

unread,
Mar 9, 2021, 3:53:53 AM3/9/21
to Gatling User Group
Hi Girish,

I believe this is because the gradle gatling plugin uses a different source set. If I'm not mistaken by default the "main" sourceSet is included into the JAR.
You should be able to include the output from the gatling sourceSet into your JAR by adding something like the following code snippet into your build.gradle:
 jar {
from sourceSets.gatling.output
}

However if the "library files" you are referring to are external dependencies like jars, you probabaly rather want to have a "FatJar" that contains all required dependencies.

Hope this helps :)

GIRISH K S

unread,
Mar 9, 2021, 12:23:54 PM3/9/21
to gat...@googlegroups.com
Julius that worked, Thanks a lot.

--
You received this message because you are subscribed to a topic in the Google Groups "Gatling User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gatling/CNiXk5fSeGs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gatling+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gatling/af9795bf-0e95-4217-a779-e0ad4b1c755dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages