I want to run karate as a stand-alone executable or jar, telling it what feature(s) to run via the command-line.
However, I need to build my own executable or jar, because I need to implement the HttpLogModifier interface in order to apply custom log masking.
The documentation tells me:
- I can download a stand-alone executable, or
- I can run karate as a stand-alone jar,
- but it doesn't tell me how to build my own executable or stand-alone jar.
Here's what I did:
- followed the Quickstart documentation to create a maven archetype project.
- deleted the example features and .java files.
- created a java package with my implementation of HttpLogModifier.
- here is what my directory structure looked like:
$ ls -R .
pom.xml src
./src:
test
./src/test:
java
./src/test/java:
headers karate-config.js logback-test.xml
./src/test/java/headers:
DemoLogModifier.java
$
I ran mvn clean, compile, test, and install and then tried to run my feature file, using the genarated jar file and giving the path to my feature file:
$ java -jar aca-karate-1.0-SNAPSHOT.jar -m ~/aca/lab/karate/karate-poc/fldfin-view.feature
no main manifest attribute, in aca-karate-1.0-SNAPSHOT.jar
$
but as you can see the jar doesn't have a main method.
I tried another way, but it also did not work:
$ java -cp aca-karate-1.0-SNAPSHOT.jar com.intuit.karate.Main -m ~/aca/lab/karate/karate-poc/fldfin-view.feature
Error: Could not find or load main class com.intuit.karate.Main
$
I'm guessing I need to add a java class file that implements Main, but I have no idea what to name it, where to put it, or what its contents should be.
Thanks for your reading and whatever help you lend.