Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

karate-demo build fails to find packages #463

Closed
sbmehdy opened this issue Jul 19, 2018 · 7 comments
Closed

karate-demo build fails to find packages #463

sbmehdy opened this issue Jul 19, 2018 · 7 comments
Labels

Comments

@sbmehdy
Copy link

sbmehdy commented Jul 19, 2018

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.

@ptrthomas
Copy link
Member

ptrthomas commented Jul 19, 2018

moved the karate-demo folder to its own: cp -R karate/karate-demo/ ~/karate-demo

no this won't work !

if you are just trying to create a new Karate project, please follow the quickstart instructions: https://github.com/intuit/karate#quickstart - I know it's not Gradle, but at least you will get a simple skeleton project as a starting point.

EDIT: we now have a wiki for Gradle: https://github.com/intuit/karate/wiki/Gradle

the karate-demo is like an advanced test-suite for karate, it is not meant as an example to create a new project. but you will be able to run it if you don't start moving folders around.

@sbmehdy
Copy link
Author

sbmehdy commented Jul 19, 2018

Thanks for the precision @ptrthomas. Is there any quickstart for gradle, or does it make sense to use a maven archetype and then switch the build process to gradle ?

EDIT: I am going to experiment with building the archetype, then using gradle's command to migrate the mvn result (gradle init which automatically detects the type pom on a maven project), but feel free to suggest better methods. Thanks.

@ptrthomas
Copy link
Member

@sbmehdy no quickstart - I have been been hoping for a contribution for a long time now and I am not a gradle user

you can see if this helps: https://github.com/intuit/karate/tree/master/karate-demo#gradle

@sbmehdy
Copy link
Author

sbmehdy commented 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!

@ptrthomas
Copy link
Member

@sbmehdy thanks ! this certainly will help others. even if someone creates a sample github project somewhere I can link to it from the documentation.

@flangel
Copy link

flangel commented Jul 31, 2018

Hi,

i didnt move a single folder, running gradle build and getting the same error:

cd /Users/me/Projects/KarateDemo/karate-demo
ls -ltr
-rw-r--r-- 1 me staff 15773 Jul 31 08:20 README.md
-rw-r--r-- 1 me staff 3008 Jul 31 08:20 build.gradle
-rwxr-xr-x 1 me staff 8706 Jul 31 08:20 pom.xml
drwxr-xr-x 4 me staff 128 Jul 31 08:20 src
drwxr-xr-x 5 me staff 160 Jul 31 08:22 build
drwxr-xr-x 3 me staff 96 Jul 31 08:33 gradle
-rwxr-xr-x 1 me staff 5046 Jul 31 08:33 gradlew
-rw-r--r-- 1 me staff 2404 Jul 31 08:33 gradlew.bat

gradle build
....

Users/me/Projects/KarateDemo/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/me/Projects/KarateDemo/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/me/Projects/KarateDemo/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/me/Projects/KarateDemo/karate-demo/src/main/java/com/intuit/karate/demo/controller/DogsController.java:52: error: lambda expression not expected here
private static final RowMapper 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
:compileJava FAILED

Any idea?

@ptrthomas
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants