Java Intro to Java Web Development with Spark Diving into Web Development Meet Spark

I'm stocked please help

On adding dependencies it says Cannot resolve com.sparkjava:spark-core:2.5

1 Answer

Alexander Nikiforov
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,136 Points

That is strange... that should work.

Could you at least post screenshot of intellijdea with error.

Much nicer would be to push project on GitHub, although for this case just posting build.gradle and/or screenshot should be enough.

Did you by chance watched 'Introduction to Gradle' Workshop?

https://teamtreehouse.com/library/dependency-management-with-gradle

If you did, did dependencies worked for you in that workshop ?

Another good try to check whether things work, is to actually git clone Craig's repository, because it works 100%

https://github.com/treehouse-projects/java-spark-course-ideas

And if after cloning and importing, intellijidea should work as well ...

Although that will require more work ...

One more question you should answer : Do other dependencies work for you ?

For example Craig also has this line

    testCompile group: 'junit', name: 'junit', version: '4.11'

Does that work ?

Could you remove compile 'com.sparkjava:spark-core:2.3' line and leave only testCompile line above?

Here is the build.gradle file from Craig's repo:

https://github.com/treehouse-projects/java-spark-course-ideas/blob/master/build.gradle

So could you tell me : Does Gradle gives error when you leave only test dependency like that :

group 'com.teamtreehouse.courses'
version '1.0-SNAPSHOT'

apply plugin: 'java'

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
}

Because if the gradle will give error for file above, then it could be the case that you checked offline work for Gradle...

One person in this link had same problem:

https://teamtreehouse.com/community/error-whenever-i-put-compile-comspringframeworkspringwebmvc433release

Yes, the problem was because it was checked offline work for Gradle in Gradle Settings

Thank you very much for your support