EMF 项目的 Maven 编译失败
Maven compilation Failure on EMF-Project
我必须使用 EMF 项目并需要使用另一个包中的一些 classes。
当我尝试使用 Maven 构建生成的代码时,我得到了这个失败:
[INFO] 6 errors
[INFO] -------------------------------------------------------------
[INFO]------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]------------------------------------------------------------------------
[INFO] Total time: 2.844 s
[INFO] Finished at: 2015-03-31T16:25:42+02:00
[INFO] Final Memory: 14M/163M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project datamodel: Compilation failure:
Compilation failure:
[ERROR] /C:/.../util/ModelSwitch.java:[20,34] cannot find symbol
[ERROR] symbol: class Switch
[ERROR] location: package org.eclipse.emf.ecore.util
[ERROR] /C:/.../util/ModelSwitch.java:[85,38] cannot find symbol
[ERROR] symbol: class Switch
[ERROR] /C:/.../util/ModelSwitch.java:[114,9] method does not override or implement a method from a supertype
[ERROR] /C:/.../util/ModelSwitch.java:[126,9] method does not override or implement a method from a supertype
[ERROR] /C:/.../util/ModelSwitch.java:[1341,9] method does not override or implement a method from a supertype
[ERROR] /C:/.../util/ModelAdapterFactory.java:[365,35] method doSwitch in class com...util.ModelSwitch<T1> cannot be applied to given types;
[ERROR] required: int,org.eclipse.emf.ecore.EObject
[ERROR] found: org.eclipse.emf.ecore.EObject
[ERROR] reason: actual and formal argument lists differ in length
所有库都已导入并在 pom 中,但生成的 ModelSwitch 仍然存在问题 class。
这个错误和 Eclipse Luna 的 bug 真是快把我逼疯了!有人可以帮我解释一下如何解决这个问题吗?
据我所知,这些是您拥有的组件的最新版本
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>ecore</artifactId>
<version>2.3.0-v200706262000</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>common</artifactId>
<version>2.3.0-v200706262000</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
<version>2.11.0-v20150123-0347</version>
</dependency>
看看different version in the repository。似乎 EMF 不久前重新命名了他们的工件。而不是这个(类似于您的其他 EMF 依赖项):
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>ecore</artifactId>
<version>2.6.1.v20100914-1218</version>
</dependency>
尝试使用这种形式(注意不同artifactId
):
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
<version>2.11.0-v20150123-0347</version>
</dependency>
这里有很多新版本可用。对我来说,2.8
以上的每个版本似乎都有效。您还可以使用一个范围,以始终获取最新版本:
<version>[2.8.0,2.99.99]</version>
我必须使用 EMF 项目并需要使用另一个包中的一些 classes。 当我尝试使用 Maven 构建生成的代码时,我得到了这个失败:
[INFO] 6 errors
[INFO] -------------------------------------------------------------
[INFO]------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]------------------------------------------------------------------------
[INFO] Total time: 2.844 s
[INFO] Finished at: 2015-03-31T16:25:42+02:00
[INFO] Final Memory: 14M/163M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project datamodel: Compilation failure:
Compilation failure:
[ERROR] /C:/.../util/ModelSwitch.java:[20,34] cannot find symbol
[ERROR] symbol: class Switch
[ERROR] location: package org.eclipse.emf.ecore.util
[ERROR] /C:/.../util/ModelSwitch.java:[85,38] cannot find symbol
[ERROR] symbol: class Switch
[ERROR] /C:/.../util/ModelSwitch.java:[114,9] method does not override or implement a method from a supertype
[ERROR] /C:/.../util/ModelSwitch.java:[126,9] method does not override or implement a method from a supertype
[ERROR] /C:/.../util/ModelSwitch.java:[1341,9] method does not override or implement a method from a supertype
[ERROR] /C:/.../util/ModelAdapterFactory.java:[365,35] method doSwitch in class com...util.ModelSwitch<T1> cannot be applied to given types;
[ERROR] required: int,org.eclipse.emf.ecore.EObject
[ERROR] found: org.eclipse.emf.ecore.EObject
[ERROR] reason: actual and formal argument lists differ in length
所有库都已导入并在 pom 中,但生成的 ModelSwitch 仍然存在问题 class。
这个错误和 Eclipse Luna 的 bug 真是快把我逼疯了!有人可以帮我解释一下如何解决这个问题吗?
据我所知,这些是您拥有的组件的最新版本
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>ecore</artifactId>
<version>2.3.0-v200706262000</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>common</artifactId>
<version>2.3.0-v200706262000</version>
</dependency>
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
<version>2.11.0-v20150123-0347</version>
</dependency>
看看different version in the repository。似乎 EMF 不久前重新命名了他们的工件。而不是这个(类似于您的其他 EMF 依赖项):
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>ecore</artifactId>
<version>2.6.1.v20100914-1218</version>
</dependency>
尝试使用这种形式(注意不同artifactId
):
<dependency>
<groupId>org.eclipse.emf</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
<version>2.11.0-v20150123-0347</version>
</dependency>
这里有很多新版本可用。对我来说,2.8
以上的每个版本似乎都有效。您还可以使用一个范围,以始终获取最新版本:
<version>[2.8.0,2.99.99]</version>