需要从spring boot 2.0中排除spring-orm模块,并从jar文件中使用它的旧版本

问题描述 投票:0回答:1

我有一个.jar工件,从技术上讲,DAO层是用旧的技术堆栈构建的。

  • Java 1.6
  • 春季3.1.0.RELEASE
  • Hibernate 3.5.6-决赛
  • Maven的

我想在我的新spring boot 2.x项目中将此.jar添加为依赖项,并将其用作应用程序的数据层。

新的app技术堆栈:

  • Java 1.8
  • Spring Boot 2.1.3
  • Spring框架5
  • 摇篮

根据我的理解,我在build.gradle中添加了旧jar作为依赖项,并排除了spring-orm模块。但gradle仍然在使用旧的.jar依赖项中的最新版本而不是使用该版本。

的build.gradle

group = 'com.test.app'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
    maven{
        credentials {
            username = "$nexusUsername"
            password = "$nexusPassword"
        }
        url "$nexusUrl"
    }
}

// exluded spring-orm from spring boot 2.x
configurations {
    compile.exclude module: 'spring-orm'
}

dependencies {
    // my older dao dependency
    implementation "com.my.older.core:dao:0.3.8-SNAPSHOT"

    implementation 'org.springframework.boot:spring-boot-starter-web'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
}

不知何故,我需要让应用程序使用旧的orm版本而不是spring boot 2.x中的新版本,因为dao .jar使用的是旧版本。

对此的任何领导都将受到高度赞赏。谢谢。

java spring spring-boot gradle spring-orm
1个回答
-1
投票
configurations.all { 
    resolutionStrategy.force 'org.springframework:spring-orm:oldversion'
}

希望这可以帮助

© www.soinside.com 2019 - 2024. All rights reserved.