当我尝试加速转换时,我收到此错误:
Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.eclipse.org/mmt/qvtd/UmlToRdbms#rdbmsMM' not found. (file:/D:/Utenti/davi9/mde-workspace/Assignment2/Models/dummy.xmi, 7, 108)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:391)
at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:356)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGenerator.java:488)
at org.eclipse.acceleo.module.sample.common.Generate.<init>(Generate.java:90)
at org.eclipse.acceleo.module.sample.common.Generate.main(Generate.java:144)
Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.eclipse.org/mmt/qvtd/UmlToRdbms#rdbmsMM' not found. (file:/D:/Utenti/davi9/mde-workspace/Assignment2/Models/dummy.xmi, 7, 108)
.....
我该如何解决这个问题?
答案 0 :(得分:0)
我有同样的问题,我按照这个解决方案修复了它: https://wiki.eclipse.org/Acceleo/FAQ#My_generation_fails_with_a_.27package_not_found.27_exception
在加载模型之前,您需要注册包。
我添加此行: “ EPackage.Registry.INSTANCE.put( XXXXPackage .eNS_URI, XXXXPackage .eINSTANCE); ”
在我用于代码生成的java类 GeneratedHMTL.java 的方法 registerPackages 中。
XXXX 是模型的名称
我希望这会对你有所帮助