question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

karate-demo build fails to find packages

See original GitHub issue

Hi! First and foremost, thanks for such an extensive doc and what seems to be an amazing project! I’m running into an issue trying out the demo and I was wondering if you could help me out. Essentially, some dependencies (spring) aren’t handled by gradle and the build fails.

System info:

  • MacOS High Sierra 10.13.5
  • Java 8 installed
  • JAVA_HOME set to /usr/libexec/java_home -v 1.8 (which is /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home on my machine)
  • Would prefer using IntelliJ (despite contribution guidelines mentionning Eclipse only, I assume it’s fine since the rest of the documentation mentions IntelliJ too)
  • am only using it through the commandline so far (have not opened the project in IntelliJ or Eclipse)

Steps to reproduce:

  • cloned the repo: git clone https://github.com/intuit/karate.git
  • moved the karate-demo folder to its own: cp -R karate/karate-demo/ ~/karate-demo
  • moved to the folder: cd ~/karate-demo
  • ran gradle wrapper with the following result
Starting a Gradle Daemon (subsequent builds will be faster)
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/1.5.3.RELEASE/spring-boot-gradle-plugin-1.5.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-tools/1.5.3.RELEASE/spring-boot-tools-1.5.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-parent/1.5.3.RELEASE/spring-boot-parent-1.5.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-dependencies/1.5.3.RELEASE/spring-boot-dependencies-1.5.3.RELEASE.pom
Download https://plugins.gradle.org/m2/com/fasterxml/jackson/jackson-bom/2.8.8/jackson-bom-2.8.8.pom
Download https://plugins.gradle.org/m2/org/apache/logging/log4j/log4j-bom/2.7/log4j-bom-2.7.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-framework-bom/4.3.8.RELEASE/spring-framework-bom-4.3.8.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/data/spring-data-releasetrain/Ingalls-SR3/spring-data-releasetrain-Ingalls-SR3.pom
Download https://plugins.gradle.org/m2/org/springframework/data/build/spring-data-build/1.9.3.RELEASE/spring-data-build-1.9.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/integration/spring-integration-bom/4.3.9.RELEASE/spring-integration-bom-4.3.9.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/security/spring-security-bom/4.2.2.RELEASE/spring-security-bom-4.2.2.RELEASE.pom
Download https://plugins.gradle.org/m2/io/spring/gradle/dependency-management-plugin/1.0.2.RELEASE/dependency-management-plugin-1.0.2.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-loader-tools/1.5.3.RELEASE/spring-boot-loader-tools-1.5.3.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-core/4.3.8.RELEASE/spring-core-4.3.8.RELEASE.pom
Download https://plugins.gradle.org/m2/org/springframework/spring-core/4.3.8.RELEASE/spring-core-4.3.8.RELEASE.jar
Download https://plugins.gradle.org/m2/io/spring/gradle/dependency-management-plugin/1.0.2.RELEASE/dependency-management-plugin-1.0.2.RELEASE.jar
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-loader-tools/1.5.3.RELEASE/spring-boot-loader-tools-1.5.3.RELEASE.jar
Download https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/1.5.3.RELEASE/spring-boot-gradle-plugin-1.5.3.RELEASE.jar

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 27s
1 actionable task: 1 executed
  • then ran ./gradlew test with the following output
Downloading https://services.gradle.org/distributions/gradle-4.1-bin.zip                                                                                                                              [415/5639]
................................................................
Starting a Gradle Daemon (subsequent builds will be faster)
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-parent/1.5.3.RELEASE/spring-boot-starter-parent-1.5.3.RELEASE.pom
Download https://repo1.maven.org/maven2/com/github/java-json-tools/json-schema-validator/2.2.8/json-schema-validator-2.2.8.pom
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-web/1.5.3.RELEASE/spring-boot-starter-web-1.5.3.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-security/1.5.3.RELEASE/spring-boot-starter-security-1.5.3.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starters/1.5.3.RELEASE/spring-boot-starters-1.5.3.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter/1.5.3.RELEASE/spring-boot-starter-1.5.3.RELEASE.pom
Download https://repo1.maven.org/maven2/org/hibernate/hibernate-validator/5.3.5.Final/hibernate-validator-5.3.5.Final.pom
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-tomcat/1.5.3.RELEASE/spring-boot-starter-tomcat-1.5.3.RELEASE.pom
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.8.8/jackson-databind-2.8.8.pom
Download https://repo1.maven.org/maven2/org/hibernate/hibernate-validator-parent/5.3.5.Final/hibernate-validator-parent-5.3.5.Final.pom
Download https://repo1.maven.org/maven2/org/springframework/spring-web/4.3.8.RELEASE/spring-web-4.3.8.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/spring-webmvc/4.3.8.RELEASE/spring-webmvc-4.3.8.RELEASE.pom
Download https://repo1.maven.org/maven2/org/jboss/arquillian/arquillian-bom/1.1.11.Final/arquillian-bom-1.1.11.Final.pom
Download https://repo1.maven.org/maven2/org/jboss/shrinkwrap/shrinkwrap-bom/1.2.3/shrinkwrap-bom-1.2.3.pom
Download https://repo1.maven.org/maven2/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-bom/2.2.0/shrinkwrap-resolver-bom-2.2.0.pom
Download https://repo1.maven.org/maven2/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-bom/2.0.0-alpha-8/shrinkwrap-descriptors-bom-2.0.0-alpha-8.pom
Download https://repo1.maven.org/maven2/org/springframework/spring-aop/4.3.8.RELEASE/spring-aop-4.3.8.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/security/spring-security-config/4.2.2.RELEASE/spring-security-config-4.2.2.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/security/spring-security-web/4.2.2.RELEASE/spring-security-web-4.2.2.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/spring-framework-bom/4.3.5.RELEASE/spring-framework-bom-4.3.5.RELEASE.pom
Download https://repo1.maven.org/maven2/com/github/java-json-tools/json-schema-core/1.2.8/json-schema-core-1.2.8.pom
Download https://repo1.maven.org/maven2/javax/mail/mailapi/1.4.3/mailapi-1.4.3.pom
Download https://repo1.maven.org/maven2/com/googlecode/libphonenumber/libphonenumber/8.0.0/libphonenumber-8.0.0.pom
Download https://repo1.maven.org/maven2/com/googlecode/libphonenumber/libphonenumber-parent/8.0.0/libphonenumber-parent-8.0.0.pom
Download https://repo1.maven.org/maven2/com/sun/mail/all/1.4.3/all-1.4.3.pom
Download https://repo1.maven.org/maven2/net/sf/jopt-simple/jopt-simple/5.0.3/jopt-simple-5.0.3.pom
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot/1.5.3.RELEASE/spring-boot-1.5.3.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-logging/1.5.3.RELEASE/spring-boot-starter-logging-1.5.3.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-autoconfigure/1.5.3.RELEASE/spring-boot-autoconfigure-1.5.3.RELEASE.pom
Download https://repo1.maven.org/maven2/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.14/tomcat-embed-websocket-8.5.14.pom
Download https://repo1.maven.org/maven2/org/apache/tomcat/embed/tomcat-embed-el/8.5.14/tomcat-embed-el-8.5.14.pom
Download https://repo1.maven.org/maven2/org/apache/tomcat/embed/tomcat-embed-core/8.5.14/tomcat-embed-core-8.5.14.pom
Download https://repo1.maven.org/maven2/com/fasterxml/classmate/1.3.3/classmate-1.3.3.pom
Download https://repo1.maven.org/maven2/org/jboss/logging/jboss-logging/3.3.1.Final/jboss-logging-3.3.1.Final.pom
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.8.8/jackson-core-2.8.8.pom
Download https://repo1.maven.org/maven2/org/springframework/spring-context/4.3.8.RELEASE/spring-context-4.3.8.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/spring-beans/4.3.8.RELEASE/spring-beans-4.3.8.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/spring-expression/4.3.8.RELEASE/spring-expression-4.3.8.RELEASE.pom
Download https://repo1.maven.org/maven2/org/springframework/security/spring-security-core/4.2.2.RELEASE/spring-security-core-4.2.2.RELEASE.pom
Download https://repo1.maven.org/maven2/org/mozilla/rhino/1.7R4/rhino-1.7R4.pom
Download https://repo1.maven.org/maven2/com/github/fge/uri-template/0.9/uri-template-0.9.pom
Download https://repo1.maven.org/maven2/com/github/fge/jackson-coreutils/1.8/jackson-coreutils-1.8.pom
Download https://repo1.maven.org/maven2/org/slf4j/log4j-over-slf4j/1.7.25/log4j-over-slf4j-1.7.25.pom
Download https://repo1.maven.org/maven2/com/github/fge/msg-simple/1.1/msg-simple-1.1.pom
Download https://repo1.maven.org/maven2/com/github/fge/btf/1.2/btf-1.2.pom
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter/1.5.3.RELEASE/spring-boot-starter-1.5.3.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-security/1.5.3.RELEASE/spring-boot-starter-security-1.5.3.RELEASE.jar
Download https://repo1.maven.org/maven2/com/github/java-json-tools/json-schema-validator/2.2.8/json-schema-validator-2.2.8.jar
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-web/1.5.3.RELEASE/spring-boot-starter-web-1.5.3.RELEASE.jar
Download https://repo1.maven.org/maven2/org/hibernate/hibernate-validator/5.3.5.Final/hibernate-validator-5.3.5.Final.jar
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-tomcat/1.5.3.RELEASE/spring-boot-starter-tomcat-1.5.3.RELEASE.jar
Download https://repo1.maven.org/maven2/com/github/java-json-tools/json-schema-core/1.2.8/json-schema-core-1.2.8.jar
Download https://repo1.maven.org/maven2/com/github/fge/jackson-coreutils/1.8/jackson-coreutils-1.8.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.8.8/jackson-databind-2.8.8.jar
Download https://repo1.maven.org/maven2/org/springframework/spring-webmvc/4.3.8.RELEASE/spring-webmvc-4.3.8.RELEASE.jar
Download https://repo1.maven.org/maven2/javax/mail/mailapi/1.4.3/mailapi-1.4.3.jar
Download https://repo1.maven.org/maven2/com/googlecode/libphonenumber/libphonenumber/8.0.0/libphonenumber-8.0.0.jar
Download https://repo1.maven.org/maven2/com/github/fge/uri-template/0.9/uri-template-0.9.jar
Download https://repo1.maven.org/maven2/com/github/fge/msg-simple/1.1/msg-simple-1.1.jar
Download https://repo1.maven.org/maven2/com/github/fge/btf/1.2/btf-1.2.jar
Download https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-starter-logging/1.5.3.RELEASE/spring-boot-starter-logging-1.5.3.RELEASE.jar
Download https://repo1.maven.org/maven2/net/sf/jopt-simple/jopt-simple/5.0.3/jopt-simple-5.0.3.jar
Download https://repo1.maven.org/maven2/org/springframework/spring-beans/4.3.8.RELEASE/spring-beans-4.3.8.RELEASE.jar
Download https://repo1.maven.org/maven2/org/springframework/spring-expression/4.3.8.RELEASE/spring-expression-4.3.8.RELEASE.jar
Download https://repo1.maven.org/maven2/org/apache/tomcat/embed/tomcat-embed-websocket/8.5.14/tomcat-embed-websocket-8.5.14.jar
Download https://repo1.maven.org/maven2/org/apache/tomcat/embed/tomcat-embed-el/8.5.14/tomcat-embed-el-8.5.14.jar
Download https://repo1.maven.org/maven2/org/apache/tomcat/embed/tomcat-embed-core/8.5.14/tomcat-embed-core-8.5.14.jar
Download https://repo1.maven.org/maven2/org/jboss/logging/jboss-logging/3.3.1.Final/jboss-logging-3.3.1.Final.jar
Download https://repo1.maven.org/maven2/com/fasterxml/classmate/1.3.3/classmate-1.3.3.jar
Download https://repo1.maven.org/maven2/org/mozilla/rhino/1.7R4/rhino-1.7R4.jar
Download https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.8.8/jackson-core-2.8.8.jar
Download https://repo1.maven.org/maven2/org/slf4j/log4j-over-slf4j/1.7.25/log4j-over-slf4j-1.7.25.jar

> Task :compileJava
/Users/mehdychaillou/karate-demo/src/main/java/com/intuit/karate/demo/util/DbUtils.java:7: error: package org.springframework.jdbc.core does not exist
import org.springframework.jdbc.core.JdbcTemplate;
                                    ^
/Users/mehdychaillou/karate-demo/src/main/java/com/intuit/karate/demo/util/DbUtils.java:8: error: package org.springframework.jdbc.datasource does not exist
import org.springframework.jdbc.datasource.DriverManagerDataSource;
                                          ^
/Users/mehdychaillou/karate-demo/src/main/java/com/intuit/karate/demo/util/DbUtils.java:18: error: cannot find symbol
    private final JdbcTemplate jdbc;
                  ^
  symbol:   class JdbcTemplate
  location: class DbUtils
/Users/mehdychaillou/karate-demo/src/main/java/com/intuit/karate/demo/controller/DogsController.java:30: error: package org.springframework.jdbc.core does not exist
import org.springframework.jdbc.core.JdbcTemplate;
                                    ^
/Users/mehdychaillou/karate-demo/src/main/java/com/intuit/karate/demo/controller/DogsController.java:31: error: package org.springframework.jdbc.core does not exist
import org.springframework.jdbc.core.RowMapper;
                                    ^
/Users/mehdychaillou/karate-demo/src/main/java/com/intuit/karate/demo/controller/DogsController.java:48: error: cannot find symbol
    private JdbcTemplate jdbc;
            ^
  symbol:   class JdbcTemplate
  location: class DogsController
/Users/mehdychaillou/karate-demo/src/main/java/com/intuit/karate/demo/controller/DogsController.java:52: error: cannot find symbol
    private static final RowMapper<Dog> ROW_MAPPER = (rs, rowNum) -> new Dog(rs.getInt("ID"), rs.getString("NAME"));
                         ^
  symbol:   class RowMapper
  location: class DogsController
/Users/mehdychaillou/karate-demo/src/main/java/com/intuit/karate/demo/util/DbUtils.java:25: error: cannot find symbol
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        ^
  symbol:   class DriverManagerDataSource
  location: class DbUtils
/Users/mehdychaillou/karate-demo/src/main/java/com/intuit/karate/demo/util/DbUtils.java:25: error: cannot find symbol
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
                                                 ^
  symbol:   class DriverManagerDataSource
  location: class DbUtils
/Users/mehdychaillou/karate-demo/src/main/java/com/intuit/karate/demo/util/DbUtils.java:30: error: cannot find symbol
        jdbc = new JdbcTemplate(dataSource);
                   ^
  symbol:   class JdbcTemplate
  location: class DbUtils
/Users/mehdychaillou/karate-demo/src/main/java/com/intuit/karate/demo/controller/DogsController.java:52: error: lambda expression not expected here
    private static final RowMapper<Dog> ROW_MAPPER = (rs, rowNum) -> new Dog(rs.getInt("ID"), rs.getString("NAME"));
                                                     ^
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
11 errors


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 50s
1 actionable task: 1 executed

I attempted to clean it, rebuild it… same thing. Happy to follow any indication or provide any more information.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sbmehdycommented, Jul 20, 2018

@ptrthomas Just as a FYI, I have managed to properly (and without any trouble) set up a gradle job from your maven archetype, if that helps. (Since gradle doesn’t have that feature built-in as-is)

mvn archetype:generate \
-DarchetypeGroupId=com.intuit.karate \
-DarchetypeArtifactId=karate-archetype \
-DarchetypeVersion=0.8.0 \
-DgroupId=com.mycompany \
-DartifactId=myproject

then:

  • gradle init
  • removing the pom.xml (rm pom.xml)
  • creating the wrapper gradlew (gradle wrapper)
  • running a clean+test (./gradlew clean test)
  • then I could substitute the build.gradle with the one from karate-demo, and start using/re-using pieces of it.

If I manage to get more comfortable with Karate, I’d happily help you with that quickstart task. In the meantime, I hope these steps help anyone in search for something to work with re:gradle. Thanks again for making Karate!

0reactions
ptrthomascommented, Jul 31, 2018

@flangel sorry I can’t help, I’ve made my position on this clear. maybe @sbmehdy can

Read more comments on GitHub >

github_iconTop Results From Across the Web

karate-demo build fails to find packages · Issue #463 - GitHub
am only using it through the commandline so far (have not opened the project in IntelliJ or Eclipse). Steps to reproduce: cloned the...
Read more >
Karate ReferenceError: package is not defined - Stack Overflow
Background: * url demoBaseUrl * def JavaDemo = Java.type('com.intuit.karate.demo.util.JavaDemo'). I noticed that the feature file is in ...
Read more >
Karate | Test Automation Made Simple.
JUnit XML reports can be generated in the “ reportDir ” path you specify, and you can easily configure your CI to look...
Read more >
Run Test Cases In Parallel & Generate Reports Using Karate ...
This tutorial explains how to perform some basic operations on the API, run test cases in parallel & generate reports with Karate Framework....
Read more >
Karate Beginner Tutorials 5 | GET API Demo - YouTube
All FREE courses - https://automationstepbystep.com/How to run a simple GET API RequestGET with BackgroundGET with Path, ParamsGET with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found