2011-03-08 53 views
2

我在netbeans的maven項目中有以下行。找不到符號(它在那裏)

Projection projection = two.translate(Vector.reg1).projection(direction); 

兩者是一個Shape實例。

public abstract class Shape { 
    public double mass; 
    public double momentOfIntertia; 
    public Vector center; 
    public abstract List<Edge> normals(Vector direction); 
    public abstract Projection projection(Vector line); 
    public abstract Shape transform(Transformation transformation); 
    public abstract Shape translate(Vector translation); 
    public abstract void render(Graphics graphics); 
} 

當我編譯我得到這個錯誤。

[ERROR]BUILD FAILURE 
------------------------------------------------------------------------ 
Compilation failure 

org/curious/pounce/Collision.java:[89,39] cannot find symbol 
symbol : method translate(org.curious.pounce.math.Vector) 
location: class org.curious.pounce.Shape 

我不確定這可能是什麼問題,如果有什麼錯誤netbeans應該指出在IDE中的錯誤,它不是。

回答

0

嘗試在涉及的所有項目上運行clean(在maven中,假設這是消息的來源)。

0

您可以嘗試執行mvn clean然後重新構建。

0

我有同樣的問題:Netbeans表示一種無效的方法,但他在那裏!我嘗試了幾種方法來解決這個問題,但沒有成功。所以,我手動將jar包歸檔到項目依賴中:右鍵單擊dependency,右鍵單擊jar-archive,手動安裝artifact。

0

我剛纔有這個問題。對我來說,這個符號在一個包裏,我使用maven來管理代碼。

只需運行:

mvn clean install 

沒有幫助我,然後我就跑:

mvn idea:clean idea:idea 

在此之後,我發現符號消失了,這意味着我看到的代碼是不是代碼我正在使用。所以我想也許是因爲IntelliJ沒有更新代碼,這導致了這種混淆。