gpt4 book ai didi

java - 类型 [类名] 的方法未定义

转载 作者:行者123 更新时间:2023-11-30 03:23:21 25 4
gpt4 key购买 nike

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

项目B pom.xml

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

项目B测试.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

关于java - 类型 [类名] 的方法未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30806592/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com