java错误switch找不到符号,java – Maven编译失败时带有“找不到符号”,而Eclipse编译...

我在Maven中有一个编译错误但在

Eclipse中一切顺利.

有什么我做错了或是Maven bug吗?

我创建了一个代码片段,因此您可以尝试重现它.

以下是Java源文件和pom.xml.

package p1;

import p1.A.D.C;

import p1.p2.E;

public class A {

interface B {

T methodB();

}

class D implements B {

C c = new C();

public C getC() {

return c;

}

class C {

public void methodC() {

System.out.println(this);

}

}

@Override

public E methodB() {

return new E();

}

}

public void methodA() {

D d = new D();

d.methodB();

C c = d.getC();

c.methodC();

}

public static void main(String[] args) {

A a = new A();

a.methodA();

}

}

package p1.p2;

public class E {

}

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0

mvntst

test

0

jar

mvntst

当我运行mvn clean compile时,我得到了这个输出:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project test: Compilation failure

[ERROR] /C:/dev/test/CompilerTest/MavenTest/src/main/java/p1/A.java:[6,30] cannot find symbol

[ERROR] symbol: class E

[ERROR] location: class p1.A

[ERROR] -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

这是mvn –version的结果:

Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-13T23:10:27+03:00)

Maven home: C:\dev\apache-maven-3.3.1\bin\..

Java version: 1.8.0_40, vendor: Oracle Corporation

Java home: C:\Program Files\Java\jdk1.8.0_40\jre

Default locale: en_US, platform encoding: Cp1252

OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值