Reputation: 100
I've never really started a project requiring external dependencies from start, so bear with me.
I'm trying to get my project setup so I can start development, but whenever I try to run the gradlew command gradlew cleanEclipse eclipse
, my dependencies don't seem to come in as I get this build for all depdencies:
Project 'ProjectName' is missing required library: 'projectPath\ProjectName\unresolved dependency - org.apache.tomcat tomcat 8.0.29'
Here is my build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.0.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
dependencies {
compile 'org.apache.tomcat:tomcat:8.0.29'
compile 'org.springframework:spring-beans:4.2.3.RELEASE'
compile 'org.springframework:spring-webmvc:4.2.3.RELEASE'
}
Am I missing something? Am I not running gradle correctly?
Thanks
Upvotes: 3
Views: 8556
Reputation: 28136
Your build configuration will work just fine if you'll provide a repositories for the project too, because now it's done just for the build script. Try to add:
repositories {
mavenCentral()
}
into your build script root. And then you just have to update a dependencies in your IDE possibly. Tried it with gradle 2.8 and IntelliJIdea.
But, you've applied spring-boot-gradle-plugin
though your project doesn't seem to be spring-boot project. If you want to use spring-boot, you need to depend on
compile("org.springframework.boot:spring-boot-starter-web")
or some other spring-boot-starter libraries. This one above, for example, will provide an embedded tomcat within. Otherwise, you don't need to have a
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.0.RELEASE")
in the build.script dependencies.
Furthermore, you don't need to apply 'java' plugin, since you have a 'war' plugin applied, because war
extends java
.
Upvotes: 2