我有一个多项目gradle,但在我的控制器模块gradle似乎没有下载spring-boot依赖(或任何其他什么 - 所以) . 根gradle构建运行顺利,完全没有错误,但我无法将任何依赖类导入到我的源代码中 .
这是gradle文件:
多项目的根build.gradle
apply plugin: 'idea'
subprojects {
apply plugin: 'idea'
}
// Ensure the IWS Workspace file is also deleted (this is not the default)
task cleanIdea(dependsOn: [cleanIdeaProject, cleanIdeaWorkspace, cleanIdeaModule],
type: Delete,
overwrite: true,
description: 'Cleans IDEA project files (IML, IPR, IWS)',
group: 'IDE')
task clean(description: 'Deletes the build directory produced by Gradle and the out directory produced by IntelliJ IDEA.',
group: 'build') << {
delete "${buildDir}", 'out'
}
内部项目build.gradle
def version = '0.0.1'
buildscript {
repositories {
maven { url "http://repo.spring.io/libs-snapshot" }
mavenCentral()
}
dependencies {
classpath('org.springframework.boot:spring-boot-gradle-plugin:1.3.0.RELEASE')
//classpath 'com.github.ben-manes:gradle-versions-plugin:0.3'
}
}
apply plugin: 'java' // http://www.gradle.org/docs/current/userguide/java_plugin.html
apply plugin: 'application' // http://www.gradle.org/docs/current/userguide/application_plugin.html
apply plugin: 'war' // http://www.gradle.org/docs/current/userguide/war_plugin.html
apply plugin: 'spring-boot'
springBoot {
mainClass = "com.mozart.Mozart"
}
idea.module {
}
repositories {
mavenCentral()
maven { url "http://repo.spring.io/libs-snapshot" }
}
configurations {
all {
exclude(group: 'commons-logging') // Never include commons-logging (use SLF4J instead)
exclude(group: 'log4j') // Never include log4j (use SLF4J instead)
}
}
jar.manifest {
attributes("Implementation-Title": "Mozart Web Site", "Implementation-Version": version)
}
processResources << {
// Workaround for Tomcat. Tomcat requires META-INF to be a non-empty subdirectory of
// build/classes/main in order for Servlet 3.0 Application Initializer scanning to work
copy {
// http://gradle.org/docs/current/userguide/working_with_files.html
from "src/main/resources/META-INF/dummy-file-required-by-tomcat.txt"
into "${sourceSets.main.output.classesDir}/META-INF"
}
}
dependencies {
compile 'org.springframework.boot:spring-boot-starter-web'
}
task runService(description: 'Starts up the service using Tomcat.',
group: 'application') << {
logging.setLevel(LogLevel.INFO)
ant.java(classname: 'com.thoughtworks.learnangularjs.server.TomcatServer',
classpath: sourceSets.test.runtimeClasspath.asPath,
fork: true,
failonerror: true)
}
编辑:settings.gradle
rootProject.name = 'MozartWeb'
include 'MozartModel', 'MozartWebSite', 'MozartWebSiteClient'
任何帮助将不胜感激 .
1 回答
好的好的!所以不要介意我!考虑到我将项目导入IntelliJ,我认为我不需要明确地称之为gradle想法......但就是这样! = /
在检查调试时,我发现依赖关系已经解决了......
但是类路径搞砸了......
希望这有助于其他人坚持这种愚蠢的事情 .
C ya