2017-05-03 87 views
0

我從這個鏈接下載了exoplatform的日曆:https://github.com/exoplatform/calendar,我試圖通過命令mvn compile war:war來生成它的戰爭。如果我運行mvn包或mvn安裝它工作正常,但是當我添加戰爭:戰爭,編譯失敗。Maven錯誤 - 無法找到符號 - 多模塊項目

下面是錯誤:

[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[48,38] package org.exoplatform.calendar.model does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[49,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[50,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[51,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[52,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[53,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[54,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[55,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[56,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[57,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[58,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[59,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[115,18] cannot find symbol 
[ERROR] symbol: class CalendarService 
[ERROR] location: class org.exoplatform.webservice.cs.calendar.CalendarWebservice 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[116,11] cannot find symbol 
[ERROR] symbol: class ExtendedCalendarService 
[ERROR] location: class org.exoplatform.webservice.cs.calendar.CalendarWebservice 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[120,17] cannot find symbol 
[ERROR] symbol: class CalendarService 
[ERROR] location: class org.exoplatform.webservice.cs.calendar.CalendarWebservice 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[134,29] cannot find symbol 
[ERROR] symbol: class ExtendedCalendarService 
[ERROR] location: class org.exoplatform.webservice.cs.calendar.CalendarWebservice 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[330,49] cannot find symbol 
[ERROR] symbol: class CalendarEvent 
[ERROR] location: class org.exoplatform.webservice.cs.calendar.CalendarWebservice 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[330,72] cannot find symbol 
[ERROR] symbol: class FeedData 
[ERROR] location: class org.exoplatform.webservice.cs.calendar.CalendarWebservice 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[630,39] cannot find symbol 
[ERROR] symbol: class CalendarSetting 
[ERROR] location: class org.exoplatform.webservice.cs.calendar.CalendarWebservice 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/webservice/cs/calendar/CalendarWebservice.java:[630,67] cannot find symbol 
[ERROR] symbol: class CalendarEvent 
[ERROR] location: class org.exoplatform.webservice.cs.calendar.CalendarWebservice 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/calendar/ws/CalendarRestApi.java:[31,1] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/calendar/ws/CalendarRestApi.java:[32,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/calendar/ws/CalendarRestApi.java:[33,49] package org.exoplatform.calendar.service.Calendar does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/calendar/ws/CalendarRestApi.java:[34,45] package org.exoplatform.calendar.service.impl does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/calendar/ws/bean/CategoryResource.java:[22,40] package org.exoplatform.calendar.service does not exist 
[ERROR] .../calendar-develop/calendar-webservice/src/main/java/org/exoplatform/calendar/ws/bean/CategoryResource.java:[33,33] cannot find symbol 
[ERROR] symbol: class EventCategory 
[ERROR] location: class org.exoplatform.calendar.ws.bean.CategoryResource 

主要POM:https://drive.google.com/file/d/0BwWIlGx_c4cXM3puSVY2YTlDWE0/view?usp=sharing

返回總是返回錯誤之一:由於堆棧溢出焦炭https://drive.google.com/file/d/0BwWIlGx_c4cXWlptTkp0VF95YlU/view?usp=sharing

我把他們安置在谷歌驅動器限制。

我已經嘗試了堆棧溢出的解決方案,比如檢查執行mvn clean install的依賴項,但是每當我添加war時:war它會返回這些錯誤。

任何人都可以幫助我嗎?

+1

使用'mvn install'或'mvn package'是構建WAR的正確方法。你爲什麼認爲你需要單獨運行'mvn war:war'? –

+0

Ok @SteveC我嘗試了你所說的話,儘管昨天嘗試了它並且沒有工作,但今天它產生了一場戰爭,並且它的行爲也相應地發生了。謝謝 – user2934164

+0

你結賬了哪個分行?或者你自己添加了'maven-war-plugin'配置嗎? 'calendar-webservice'模塊旨在成爲'calendar-webapp'中包含的'jar',它是構建爲WAR的實際Web應用程序。 –

回答

0

是的。調用戰爭目標的正確方法是:

mvn compile war:war 

現在,你仍然可以看到錯誤,看來,有可能是一個項目到另一個的依賴。而且,由於無法在本地存儲庫中找到依賴項(因爲您尚未在本地存儲庫中安裝該依賴項),因此無法在類路徑中添加依賴項,從而導致錯誤。

+0

這不是你如何構建WAR文件。當包裝在pom.xml中設置爲'war'時,Maven會自動構建一個WAR文件。 –

+0

是的。同意。但正如問題所有人問到的那樣,我根據自己的意願給出了答案。 – Shinchan