lnkToKing
lnkToKing
2017-06-23 06:12

IDEA导入gradle项目,所以用compile方式引入包都变成了provided

  • gradle
  • intellij-idea

build.gradle文件配置如下:

 buildscript {
    ext {
        springBootVersion = '1.5.2.RELEASE'
    }
    repositories {
        mavenLocal()
        jcenter()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

version '1.0-SNAPSHOT'

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'

sourceCompatibility = 1.8
targetCompatibility = 1.8

[javadoc, compileTestJava]*.options*.encoding = 'UTF-8'

compileJava {
    options.encoding = 'UTF-8'
    options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}

repositories {
    mavenLocal()
    //mavenCentral()
    jcenter()
}

configurations {
    compile.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
    compile.exclude group: 'org.apache.tomcat'
    compile.exclude group: 'org.apache.tomcat.embed'
    all*.exclude module: 'spring-boot-starter-logging'
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-jersey')
    //compile('org.springframework.boot:spring-boot-starter-actuator')
    compile('org.springframework.boot:spring-boot-starter-undertow')
    compile('org.springframework.boot:spring-boot-starter-log4j2')

    compile('org.mybatis.spring.boot:mybatis-spring-boot-starter:1.1.1') // mybatis support

    // use swagger2 for api documentation
    compile('io.swagger:swagger-jersey2-jaxrs:1.5.10')

    compile('org.apache.commons:commons-lang3:3.4')
    compile('commons-codec:commons-codec:1.10')

    runtime('com.alibaba:druid:1.0.27') // alibaba datasource
    runtime('mysql:mysql-connector-java') // mysql jdbc driver
    runtime('org.apache.logging.log4j:log4j-jul:2.7') // log4j jul bridge(for java.util.logging.Logger)

    testCompile('org.springframework.boot:spring-boot-starter-test')
    testCompile('org.glassfish.jersey.connectors:jersey-apache-connector:2.25.1') // support jersey client using apache http client
}

idea {
    module {
        downloadJavadoc = false
        downloadSources = true
    }
}

IDEA导入项目后的包变成了provided
图片说明

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换