2017-07-19 76 views
0

我已經使用Eclipse IDE從我的Java項目創建了一個jar。 然後我已經將該jar添加到我的spring boot maven項目的構建路徑中。 當我試圖maven乾淨和添加我的自定義jar後安裝,我無法成功運行maven安裝。 我收到以下錯誤,無法安裝maven installer

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project springBootExample: Compilation failure: Compilation failure: 
[ERROR] error reading C:\Users\VAIBHAV-PC\.m2\repository\org\hsqldb\hsqldb\2.3.3\hsqldb-2.3.3.jar; invalid LOC header (bad signature) 
[ERROR] /D:springBootExample/src/main/java/com/springBootExample/service/impl/UserServiceImpl.java:[9,29] package com.ResponceGenerator does not exist 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException. 
+0

這似乎是相關的:[錯誤]錯誤讀取C:\ Users \ VAIBHAV-P C.m2 \庫\組織\ HSQLDB \ HSQLDB \ 2.3.3 \ HSQLDB-2.3.3.jar;無效的LOC標頭(錯誤簽名)[錯誤]。按照錯誤消息運行並打開-X開關。你會得到更多的信息。我覺得Maven找到了。這是您當地的.m2回購有問題。 – duffymo

+0

刪除'C:\ Users \ VAIBHAV-PC.m2 \ repository \ org \ hsqldb \ hsqldb \ 2.3.3'文件夾並重試。 – talex

+0

'VAIBHAV-PC.m2'看起來很奇怪。可能是錯誤的Maven倉庫文件夾設置。你如何調用maven?同時檢查'settings.xml'。 – talex

回答

0

你可以上傳SpringBoot項目的pom.xml?下面是例子。還要確保自定義jar在你的本地maven倉庫中。

項目一個pom.xml(添加下面的插件)

<plugin> 
       <groupId>org.springframework.boot</groupId> 
       <artifactId>spring-boot-maven-plugin</artifactId> 
       <version>1.4.1.RELEASE</version> 
       <executions> 
        <execution> 
         <goals> 
          <goal>repackage</goal> 
         </goals> 
         <configuration> 
          <classifier>exec</classifier> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 

項目B的pom.xml(添加本地的回購信息,包括A計劃下的依賴性節)

<repositories> 
    <repository> 
     <id>local-repo</id> 
     <url>file:${user.home}\.m2\repository</url> 
    </repository> 
</repositories> 

項目A的信息

+0

我無法附加我的pom.xml代碼,因爲限制字符的長度。 –

+0

我想從java項目中創建一個jar以實現某些特定的功能,所以無論何時我想再次使用該功能,我只需要將該jar添加到我的項目中。您可以從中提供一個鏈接,我可以從中瞭解更多信息。 –