类型 [Class Name] 的方法未定义

The method is undefined for the type [Class Name]

我必须让项目都包含 pom.xml ,比如说项目 A 和项目 B。在项目 B 中,我在其 pom.xml 中添加了项目 A 作为依赖项。在项目 A 中有一个 class Mirror.java,在这个 class 中,我添加了方法,然后通过右键单击它并更新项目来更新项目 B,以便项目 A 的 jar 更新为新代码。现在,当我尝试调用此方法时,它在项目 B 中不可见,尽管 Maven 依赖项中的 .class 文件包含新方法

项目 B pom.xml

  <dependency>
        <groupId>com.intel.imc.swa.jetdb</groupId>
        <artifactId>mirror</artifactId>
        <version>0.1.4</version>
    </dependency>

项目 B Test.class

 new Mirror(db.getConnectionString(), "EABase_JET4_empty.eap",eap.getAbsolutePath()).webrun();

项目 A Mirror.java

   public Mirror(String source, String template, String target) throws SQLException, IOException {
    this.sourceString=source;
    this.templateFileString=template;
    this.targetFileString=target;
} 


public void webrun() {
 System.out.print("test");
}

为什么 webrun 方法在项目 B 中不可用?

谢谢

您必须先构建项目 A,然后再构建项目 B。您还必须在 Maven 中使用 -U 标志:

 $ mvn clean install  // in A
 $ mvn clean install -U // in B to force update of snapshots