使用以下sourceSet的gradle:
sourceSets{
main{
output.classesDir = new File(buildDir, "classes/java/main")
}
}
根据https://docs.gradle.org/4.0-rc-2/release-notes.html 我仍然有错误:
Gradle现在为每种JVM语言使用单独的输出目录,但是此构建假定来自源集的所有类的单个目录。此行为已被弃用,计划在Gradle 5.0中删除
请帮助,我的tomcat serer整体运行,但我喜欢摆脱这条消息。
这是我的gradle文件
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.3'
}
}
apply plugin: 'com.bmuschko.tomcat'
apply plugin: 'java'
apply plugin: 'war'
sourceSets{
main{
output.classesDir = new File(buildDir, "classes/java/main")
}
}
sourceCompatibility = 1.8
version = '1.0'
ext {
javaVersion = 1.8
springVersion = '4.3.10.RELEASE'
aspectjVersion = '1.8.10'
slf4jVersion = '1.7.25'
}
dependencies {
compile (group: 'org.springframework', name: 'spring-context', version: springVersion){
exclude group: 'commons-logging', module: 'commons-logging'
}
compile group: 'org.springframework', name: 'spring-webmvc', version: springVersion
compile group: 'org.aspectj', name: 'aspectjrt', version: aspectjVersion
compile group: 'org.slf4j', name: 'jcl-over-slf4j', version: slf4jVersion
testCompile group: 'org.slf4j', name: 'slf4j-log4j12', version: slf4jVersion
compile (group: 'log4j', name: 'log4j', version: '1.2.17') {
exclude group: 'javax.mail', module: 'mail'
exclude group: 'javax.jms', module: 'jms'
exclude group: 'com.sun.jdmk', module: 'jmxtools'
exclude group: 'com.sun.jmx', module: 'jmxri'
}
compile group: 'javax.inject', name: 'javax.inject', version: '1'
providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'
providedCompile group: 'javax.servlet.jsp', name: 'javax.servlet.jsp-api', version: '2.3.1'
compile group: 'javax.servlet', name: 'jstl', version: '1.2'
testCompile 'junit:junit:4.12'
}
repositories {
mavenCentral()
}
dependencies {
def tomcatVersion = '8.5.16'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:8.5.2",
"org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"
}
tomcat {
httpProtocol = 'org.apache.coyote.http11.Http11Nio2Protocol'
ajpProtocol = 'org.apache.coyote.ajp.AjpNio2Protocol'
httpPort = 8080
contextPath = '/'
}