【发布时间】:2016-10-24 09:11:19
【问题描述】:
我正在尝试构建一个带有 microsoft sql server 连接的 springboot 应用程序。我建立了与 mysql 的连接,它工作正常,但现在我无法连接到我的 mssql 数据库,因为 springboot gradle 脚本没有加载 'com.microsoft.sqlserver:sqljdbc4' jar。我试图通过 gradle 脚本在非 springboot 项目中加载 jar,它工作正常。 springboot 是在做我不知道的事情吗?还是有其他问题?
我的 gradle 脚本:
buildscript {
ext {
springBootVersion = '1.4.0.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
jar {
baseName = 'BEAT-Surflet'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('com.microsoft.sqlserver:sqljdbc4')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework:spring-jms')
compile('org.apache.activemq:activemq-broker')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
也许问题是,springboot 尝试自己加载版本或因此而发生冲突。我也试图明确地给他版本('com.microsoft.sqlserver:sqljdbc4:4.0'),但它也不起作用。那么为什么我的 gradle-script 或者我的 springboot 项目没有加载 mssql jar 呢?
【问题讨论】:
标签: java sql-server spring gradle spring-boot