2016-03-22 68 views
-3

我將一個大的Java項目傳遞給了maven,並替換了maven中使用的所有庫,我可以運行調試或開始就好,這意味着它可以正常工作,但出於某種原因我嘗試運行maven測試或安裝或嘗試使用maven編譯它失敗的任何東西。Maven無法編譯項目,即使我可以調試它

這是我的POM文件(我使用第三方罐關係):

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
<modelVersion>4.0.0</modelVersion> 
<groupId>pbclient2</groupId> 
<artifactId>pbclient2</artifactId> 
<version>0.0.1-SNAPSHOT</version> 
<name>Name</name> 
<description>Description</description> 
<dependencies> 
    <dependency> 
     <groupId>c3p0</groupId> 
     <artifactId>c3p0</artifactId> 
     <version>0.9.1.2</version> 
    </dependency> 
    . 
    . 
    . 
    <dependency> 
     <groupId>mxmlc</groupId> 
     <artifactId>mxmlc</artifactId> 
     <version>1.0</version> 
     <classifier>mxmlc</classifier> 
    </dependency> 
</dependencies> 

<build> 
    <resources> 
     <resource> 
      <directory>src</directory> 
     </resource> 
    </resources> 
    <sourceDirectory>src</sourceDirectory> 
    <pluginManagement> 
     <plugins> 
      <plugin> 
       <inherited>true</inherited> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 



      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>build-helper-maven-plugin</artifactId> 
       <version>1.1</version> 
       <executions> 
        <execution> 
         <id>add-source</id> 
         <phase>generate-sources</phase> 
         <goals> 
          <goal>add-source</goal> 
         </goals> 
         <configuration> 
          <sources> 
           <source>src</source> 
          </sources> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 

      <!-- <plugin> <groupId>com.google.appengine</groupId> <artifactId>appengine-maven-plugin</artifactId> 
       <version>1.9.32</version> <configuration> <enableJarClasses>false</enableJarClasses> 
       </configuration> <executions> <execution> <goals> <goal>endpoints_get_discovery_doc</goal> 
       </goals> </execution> </executions> </plugin> --> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <version>2.10</version> 
       <executions> 
        <execution> 
         <phase>test</phase> 
         <id>analyze</id> 
         <goals> 
          <goal>analyze-only</goal> 
         </goals> 
         <configuration> 
          <failOnWarning>true</failOnWarning> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </pluginManagement> 
</build></project> 

我已經嘗試了很多的插件,並試圖刪除存儲庫中的.m2但似乎沒有任何幫助。

我得到的錯誤是

[錯誤]/C:/用戶/ WORX-PC-01/git的/ PbClient/pbclient2/src目錄/ PB/UI /面板/管理/工作訂單/配置/namingConvention/GenericNamingConventionTableModel.java:[10,24]包com.pb.hibernate不存在

[ERROR]/C:/用戶/ WORX-PC-01/GIT中/ PbClient/pbclient2/SRC/PB/UI /板/管理/工作訂單/配置/命名會議/ GenericNamingConventionTableModel.java:[192,36]找不到符號 符號:類PbPwoNamingConfiguration 位置:類pb.ui.panels.admin.workorders.configuration.namingConvention.GenericNamingConventionTableModel

包確實存在,我不明白爲什麼這不會像它應該的那樣工作。

enter image description here

難道我做錯了什麼,因爲我使用maven剛剛起步。

+1

如果您的項目中不存在「com.pb.hibernate」包,依賴關係在你的pom中被正確定義了嗎? – beresfordt

+0

您正在部署哪臺服務器? – MDaniyal

+1

@beresfordt我沒有看到它正在尋找的包是在另一個項目中,因爲他們曾經使用螞蟻來構建它 把你的建議檢查包作爲答案,所以我可以接受它:) – InsaneCricket

回答

1

錯誤消息告訴我,您的項目中不存在軟件包com.pb.hibernate(可能它已被重命名,並且您的IDE沒有正確更新每次使用),或者它存在於IDE的外部依賴項中不知何故在運行/調試時得到了它的路徑,但在您的POM中沒有正確定義依賴關係,因此運行mvn clean install失敗