最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

screw?Maven插件方式運(yùn)行時(shí)在編譯打包時(shí)跳過執(zhí)行的問題解決方法

 更新時(shí)間:2023年03月22日 09:46:59   作者:飛一站  
這篇文章主要介紹了screw?Maven插件方式運(yùn)行時(shí)在編譯打包時(shí)跳過執(zhí)行的問題解決方法,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

解決screw Maven插件方式運(yùn)行時(shí),在編譯打包時(shí)跳過執(zhí)行的問題

問題描述

在引入screw 進(jìn)行數(shù)據(jù)庫文檔生成,并且使用Maven插件方式運(yùn)行時(shí),在執(zhí)行項(xiàng)目打包時(shí),會自動運(yùn)行該插件。導(dǎo)致在不需要重新生成數(shù)據(jù)庫文檔時(shí),也會去生成數(shù)據(jù)庫文檔。并且通常數(shù)據(jù)庫文檔生成是基于開發(fā)環(huán)境的數(shù)據(jù)庫的,對于非開發(fā)環(huán)境的自動打包處理環(huán)境,往往是無法訪問開發(fā)環(huán)境數(shù)據(jù)庫,這也會導(dǎo)致項(xiàng)目的打包出錯(cuò)的問題。出錯(cuò)信息如下:

不帶-X參數(shù)的出錯(cuò)信息:

[INFO] --- screw-maven-plugin:1.0.5:run (default) @ java-abc-cids-interfaces ---
[INFO] Database design document generation begins ??
[INFO] screw - Starting...
Build step 'Invoke top-level Maven targets' marked build as failure

-X參數(shù)的出錯(cuò)信息:

[INFO] Database design document generation begins ??
[DEBUG] Driver class com.mysql.cj.jdbc.Driver found in Thread context class loader ClassRealm[plugin>cn.smallbun.screw:screw-maven-plugin:1.0.5, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@ba8a1dc]
[DEBUG] screw - configuration:
[DEBUG] allowPoolSuspension.............false
[DEBUG] autoCommit......................true
[DEBUG] catalog.........................none
[DEBUG] connectionInitSql...............none
[DEBUG] connectionTestQuery.............none
[DEBUG] connectionTimeout...............30000
[DEBUG] dataSource......................none
[DEBUG] dataSourceClassName.............none
[DEBUG] dataSourceJNDI..................none
[DEBUG] dataSourceProperties............{useInformationSchema=true, password=<masked>}
[DEBUG] driverClassName................."com.mysql.cj.jdbc.Driver"
[DEBUG] exceptionOverrideClassName......none
[DEBUG] healthCheckProperties...........{}
[DEBUG] healthCheckRegistry.............none
[DEBUG] idleTimeout.....................600000
[DEBUG] initializationFailTimeout.......1
[DEBUG] isolateInternalQueries..........false
[DEBUG] jdbcUrl.........................jdbc:mysql://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[DEBUG] leakDetectionThreshold..........0
[DEBUG] maxLifetime.....................1800000
[DEBUG] maximumPoolSize.................10
[DEBUG] metricRegistry..................none
[DEBUG] metricsTrackerFactory...........none
[DEBUG] minimumIdle.....................10
[DEBUG] password........................<masked>
[DEBUG] poolName........................"screw"
[DEBUG] readOnly........................false
[DEBUG] registerMbeans..................false
[DEBUG] scheduledExecutor...............none
[DEBUG] schema..........................none
[DEBUG] threadFactory...................internal
[DEBUG] transactionIsolation............default
[DEBUG] username........................"xxxxx"
[DEBUG] validationTimeout...............5000
[INFO] screw - Starting...
[DEBUG] screw - Failed to create/setup connection: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
[DEBUG] screw - Cannot acquire connection from data source
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException (SQLError.java:174)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException (SQLExceptionsMapping.java:64)
    at com.mysql.cj.jdbc.ConnectionImpl.createNewIO (ConnectionImpl.java:836)
    at com.mysql.cj.jdbc.ConnectionImpl.<init> (ConnectionImpl.java:456)
    at com.mysql.cj.jdbc.ConnectionImpl.getInstance (ConnectionImpl.java:246)
    at com.mysql.cj.jdbc.NonRegisteringDriver.connect (NonRegisteringDriver.java:197)
    at com.zaxxer.hikari.util.DriverDataSource.getConnection (DriverDataSource.java:138)
    at com.zaxxer.hikari.pool.PoolBase.newConnection (PoolBase.java:358)
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry (PoolBase.java:206)
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry (HikariPool.java:477)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast (HikariPool.java:560)
    at com.zaxxer.hikari.pool.HikariPool.<init> (HikariPool.java:115)
    at com.zaxxer.hikari.HikariDataSource.<init> (HikariDataSource.java:81)
    at cn.smallbun.screw.maven.plugin.mojo.RunDocMojo.getDataSource (RunDocMojo.java:274)
    at cn.smallbun.screw.maven.plugin.mojo.RunDocMojo.execute (RunDocMojo.java:197)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    ...

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:10 min
[INFO] Finished at: 2023-03-20T13:23:57+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal cn.smallbun.screw:screw-maven-plugin:1.0.5:run (default) on project java-abc-cids-interfaces: Execution default of goal cn.smallbun.screw:screw-maven-plugin:1.0.5:run failed: Failed to initialize pool: Communications link failure
[ERROR] 
[ERROR] The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.: connect timed out
[ERROR] -> [Help 1] 

調(diào)研

通常的對于Maven插件跳過使用,我們只需要找插件的對應(yīng)的skip 參數(shù),然后在打包時(shí)通過-D 參數(shù)來修改這個(gè)參數(shù)即可,但通過閱讀這個(gè)插件的源碼,并且開啟Maven的-X 參數(shù)執(zhí)行,都沒有在這個(gè)插件中找到skip 參數(shù)。

插件啟動執(zhí)行代碼位置:https://gitcode.net/mirrors/pingfangushi/screw/-/blob/master/screw-maven-plugin/src/main/java/cn/smallbun/screw/maven/plugin/mojo/RunDocMojo.java

通過查看代碼得知,插件的默認(rèn)觸發(fā)執(zhí)行的PhaseCOMPILE,因此解決的思路就有了。

解決方案

方案1

注釋掉插件引入代碼,在開發(fā)環(huán)境需要手動執(zhí)行的時(shí)候,再放開注釋。

方案2

不再寫死配置的Phase ,而是指定一個(gè)變量,由運(yùn)行Maven命令時(shí),通過參數(shù)-D 傳入正確的Phase ,而不需要執(zhí)行的時(shí)候,傳入一個(gè)不存在的Phase 或者干脆不傳入Phase 即可。

修改前:

      <plugin>
        <groupId>cn.smallbun.screw</groupId>
        <artifactId>screw-maven-plugin</artifactId>
        <version>1.0.5</version>
        <dependencies>
          <!-- HikariCP -->
          <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>3.4.5</version>
          </dependency>
          <!--mysql driver-->
          <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.20</version>
          </dependency>
        </dependencies>
        <configuration>
          ... 省略
        </configuration>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

修改后:

...
      <plugin>
        <groupId>cn.smallbun.screw</groupId>
        <artifactId>screw-maven-plugin</artifactId>
        <version>1.0.5</version>
        <dependencies>
          <!-- HikariCP -->
          <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>3.4.5</version>
          </dependency>
          <!--mysql driver-->
          <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.20</version>
          </dependency>
        </dependencies>
        <configuration>
          ... 省略
        </configuration>
        <executions>
          <execution>
            <phase>${mvn.screw.skip}</phase>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

Maven 運(yùn)行的方法:

  • 不需要運(yùn)行

clean package -Dmvn.screw.skip=none -f pom.xml 或者 clean package -f pom.xml

  • 需要運(yùn)行

clean package -Dmvn.screw.skip=compile -f pom.xml

  • 單獨(dú)運(yùn)行:

screw:run -f pom.xml

到此這篇關(guān)于screw Maven插件方式運(yùn)行時(shí)在編譯打包時(shí)跳過執(zhí)行的問題解決方法的文章就介紹到這了,更多相關(guān)screw Maven編譯打包跳過執(zhí)行內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Java中File、Base64、MultipartFile之間相互轉(zhuǎn)換的代碼詳解

    Java中File、Base64、MultipartFile之間相互轉(zhuǎn)換的代碼詳解

    File、Base64和MultipartFile都是在編程中常用的類或者數(shù)據(jù)類型,用于處理文件和數(shù)據(jù)的存儲、傳輸和轉(zhuǎn)換等操作,本文將給大家介紹了Java中File、Base64、MultipartFile之間相互轉(zhuǎn)換,文中有詳細(xì)的代碼示例供大家參考,需要的朋友可以參考下
    2024-04-04
  • spring之SpEL表達(dá)式詳解

    spring之SpEL表達(dá)式詳解

    這篇文章主要介紹了spring之SpEL表達(dá)式詳解,具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-02-02
  • Spring Boot 實(shí)現(xiàn)https ssl免密登錄(X.509 pki登錄)

    Spring Boot 實(shí)現(xiàn)https ssl免密登錄(X.509 pki登錄)

    這篇文章主要介紹了Spring Boot 實(shí)現(xiàn)https ssl免密登錄(X.509 pki登錄),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2021-01-01
  • Mybatis和其他主流框架的整合使用過程詳解

    Mybatis和其他主流框架的整合使用過程詳解

    MyBatis最初是Apache的一個(gè)開源項(xiàng)目iBatis,?2010年6月這個(gè)項(xiàng)目由Apache?Software?Foundation遷移到了Google?Code,這篇文章主要介紹了Mybatis和其他主流框架的整合使用,需要的朋友可以參考下
    2023-11-11
  • Java泛型通配符的使用詳解

    Java泛型通配符的使用詳解

    本文主要介紹了Java泛型通配符的使用詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-01-01
  • java實(shí)現(xiàn)大文本文件拆分

    java實(shí)現(xiàn)大文本文件拆分

    這篇文章主要為大家詳細(xì)介紹了java實(shí)現(xiàn)大文本文件拆分,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-05-05
  • springsecurity 企業(yè)微信登入的實(shí)現(xiàn)示例

    springsecurity 企業(yè)微信登入的實(shí)現(xiàn)示例

    本文主要介紹了springsecurity 企業(yè)微信登入的實(shí)現(xiàn)示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-04-04
  • 在Spring中編寫事務(wù)的介紹

    在Spring中編寫事務(wù)的介紹

    今天小編就為大家分享一篇關(guān)于在Spring中編寫事務(wù)的介紹,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧
    2019-01-01
  • Spring?Boot?Admin?監(jiān)控指標(biāo)接入Grafana可視化的實(shí)例詳解

    Spring?Boot?Admin?監(jiān)控指標(biāo)接入Grafana可視化的實(shí)例詳解

    Spring Boot Admin2 自帶有部分監(jiān)控圖表,如圖,有線程、內(nèi)存Heap和內(nèi)存Non Heap,這篇文章主要介紹了Spring?Boot?Admin?監(jiān)控指標(biāo)接入Grafana可視化,需要的朋友可以參考下
    2022-11-11
  • Java JDK11的下載與安裝教程

    Java JDK11的下載與安裝教程

    這篇文章主要介紹了Java JDK11的下載與安裝,本文以win10為例給大家講解win10系統(tǒng)下載安裝jdk11的教程,需要的朋友可以參考下
    2023-05-05

最新評論

潜山县| 静海县| 五原县| 济源市| 聂荣县| 健康| 德化县| 京山县| 德庆县| 瓮安县| 安陆市| 商南县| 富平县| 昌黎县| 会泽县| 井冈山市| 东光县| 介休市| 平果县| 玛纳斯县| 宁化县| 西盟| 晋江市| 张家界市| 永和县| 离岛区| 纳雍县| 瓦房店市| 平湖市| 鹤山市| 曲靖市| 张掖市| 密山市| 临清市| 莒南县| 宜兰县| 北辰区| 界首市| 孟津县| 宜城市| 宁化县|