lnkToKing 2017-06-23 06:12 采纳率: 0%
浏览 10068

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

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条回答

  • lnkToKing 2017-06-26 03:37
    关注

    问题解决了,本来用的是2016.3的版本,用最新2017.1的版本就好了

    评论

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站