亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何從spring-boot-starter-parent排除特定依賴項

如何從spring-boot-starter-parent排除特定依賴項

Cats萌萌 2021-04-30 14:19:03
我正在使用舊版Spring應用程序,并且想要遷移到Spring Boot。我的意圖是使用spring-boot-starter-data-jpa。因此,我在pom.xml(管理所有spring-boot-dependencies)中添加了以下部分:<parent>    <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-starter-parent</artifactId>    <version>2.0.3.RELEASE</version></parent>但這搞砸了我需要暫時保留的某些依賴項。我目前正在使用Selenium依賴項(版本2.53.0;從另一個項目中過渡添加),但是spring-boot正在獲取的依賴項3.9.1。我想排除3.9.1依賴關系,但exclusion過濾器無法按預期工作。只是為了總結,我想用spring-boot-starter-parent和spring-boot-starter-data-jpa而不是管理selenium-java的spring-boot-dependencies。感謝這方面的幫助。
查看完整描述

3 回答

?
楊__羊羊

TA貢獻1943條經驗 獲得超7個贊


不要弄亂<excludes>然后嘗試弄清楚您需要再次包含什么(在弄清楚被排除的內容之后)。只需覆蓋《Spring Boot參考指南》中此處解釋的版本即可。

假設您將spring-boot-starter-parent用作父項,則只需<selenium.version><properties>部分中添加即可指定所需的版本。

<properties>
  <selenium.version>2.53.0</selenium.version>
  </properties>

這將使Spring Boot使用所需的版本。


查看完整回答
反對 回復 2021-05-19
?
慕姐4208626

TA貢獻1852條經驗 獲得超7個贊

在pom.xml中提及您的依賴性,您需要在排除標記中排除它。然后排除的依賴項將不會下載:


<dependency>

      <groupId>sample.ProjectA</groupId>

      <artifactId>Project-A</artifactId>

      <version>1.0</version>

      <scope>compile</scope>

      <exclusions>

        <exclusion> 

 <!-- declare the exclusion here -->

          <groupId>sample.ProjectB</groupId>

          <artifactId>Project-B</artifactId>

        </exclusion>

      </exclusions> 

    </dependency>


查看完整回答
反對 回復 2021-05-19
  • 3 回答
  • 0 關注
  • 1307 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號