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的版本就好了

    评论

报告相同问题?

悬赏问题

  • ¥50 求图像处理的matlab方案
  • ¥50 winform中使用edge的Kiosk模式
  • ¥15 关于#python#的问题:功能监听网页
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信