如何解决错误 Mwe2Launcher:无法找到名称的 EClass

发布于 2025-01-04 14:12:58 字数 4667 浏览 1 评论 0原文

我创建了一个 Xpand 生成器。在其 src/ 文件夹中,我定义了模型 My.nn、模板和工作流程。

这就是我的工作流程.mwe2 文件的样子:

module workflow.NeuralNetworksGenerator

import org.eclipse.emf.mwe.utils.*

var targetDir = "src-gen"
var fileEncoding = "Cp1252"
var modelPath = "src/model"

Workflow {
    component = org.eclipse.xtext.mwe.Reader {
        // lookup all resources on the classpath
        //useJavaClassPath = true

        // or define search scope explicitly
        path = modelPath

        // this class will be generated by the xtext generator 
        register = org.xtext.example.neuralnetworks.NeuralNetworksStandaloneSetup {}
        load = {
            slot = "systems"
            type = "System"
        }
    }

    component = org.eclipse.xpand2.Generator {
        expand = "templates::Template::main FOREACH systems"
        outlet = {
            path = targetDir
        }
        fileEncoding = fileEncoding
    }
}

当我尝试将此工作流程.mwe2 文件作为 MWE2 工作流程运行时,我收到以下错误:

0    INFO  AbstractExpressionsUsingWorkflowComponent - No meta models configured, using JavaBeans as default.
75   ERROR Mwe2Launcher       - Problems running workflow workflow.NeuralNetworksGenerator: Couldn't find EClass for name 'System'.
java.lang.RuntimeException: Problems running workflow workflow.NeuralNetworksGenerator: Couldn't find EClass for name 'System'.
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:99)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:64)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:55)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
Caused by: org.eclipse.emf.mwe.core.WorkflowInterruptedException: Couldn't find EClass for name 'System'.
    at org.eclipse.xtext.mwe.SlotEntry.findEClasses(SlotEntry.java:135)
    at org.eclipse.xtext.mwe.SlotEntry.put(SlotEntry.java:91)
    at org.eclipse.xtext.mwe.AbstractReader.addModelElementsToContext(AbstractReader.java:95)
    at org.eclipse.xtext.mwe.Reader.invokeInternal(Reader.java:166)
    at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
    at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
    at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
    at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
    at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:97)
    ... 5 more

我用来创建特定工作流程 mwe2 文件的示例取自 Xpand参考手册。

这是 MANIFEST.MF 文件中的插件依赖项列表:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: my.neuralnetworks.generator.project
Bundle-SymbolicName: my.neuralnetworks.generator.project; singleton:=true
Bundle-Version: 1.0.0
Require-Bundle: org.eclipse.jdt.core;bundle-version="3.5.0",
 org.eclipse.xtend.profiler;resolution:=optional,
 org.apache.commons.logging,
 org.apache.log4j;resolution:=optional,
 com.ibm.icu;bundle-version="4.0.1",
 org.antlr.runtime;bundle-version="3.0.0",
 org.eclipse.core.runtime;bundle-version="3.5.0",
 org.eclipse.emf.mwe.utils;bundle-version="0.7.0",
 org.eclipse.emf.ecore.xmi;bundle-version="2.5.0",
 org.eclipse.jface.text;bundle-version="3.5.0",
 org.eclipse.xpand;bundle-version="0.7.0",
 org.eclipse.xtend;bundle-version="0.7.0",
 org.eclipse.xtend.typesystem.emf;bundle-version="0.7.0",
 org.eclipse.xtend.backend;bundle-version="1.0.0";resolution:=optional,
 org.eclipse.xtend.middleend.xpand;bundle-version="1.0.0";resolution:=optional,
 org.eclipse.xtend.middleend.xtend;bundle-version="1.0.0";resolution:=optional,
 neuralnetworks;bundle-version="1.0.0",
 org.xtext.example.neuralnetworks;bundle-version="1.0.0",
 org.eclipse.emf.ecore.xmi.source;bundle-version="2.7.0",
 org.eclipse.jface.text.source;bundle-version="3.7.0",
 org.antlr.runtime.source;bundle-version="3.2.0",
 org.antlr.runtime_3.1.b1;bundle-version="3.1.0",
 com.ibm.icu.source;bundle-version="4.4.2",
 org.eclipse.jdt.core.source;bundle-version="3.7.0",
 org.eclipse.emf.mwe2.launch;bundle-version="2.2.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: nn

neuralnetworks 插件引用我的图形编辑器的 gmf 项目,其中可以找到元模型和 org.xtext .example.neuralnetworks 是与我的文本编辑器相对应的。

emf文件对应的ecore文件中确实有EClass系统。

I created a Xpand generator. In its src/ folder I've defined my model My.nn a template and a workflow.

This is how my workflow.mwe2 file looks like:

module workflow.NeuralNetworksGenerator

import org.eclipse.emf.mwe.utils.*

var targetDir = "src-gen"
var fileEncoding = "Cp1252"
var modelPath = "src/model"

Workflow {
    component = org.eclipse.xtext.mwe.Reader {
        // lookup all resources on the classpath
        //useJavaClassPath = true

        // or define search scope explicitly
        path = modelPath

        // this class will be generated by the xtext generator 
        register = org.xtext.example.neuralnetworks.NeuralNetworksStandaloneSetup {}
        load = {
            slot = "systems"
            type = "System"
        }
    }

    component = org.eclipse.xpand2.Generator {
        expand = "templates::Template::main FOREACH systems"
        outlet = {
            path = targetDir
        }
        fileEncoding = fileEncoding
    }
}

When I'm trying to run this workflow.mwe2 file as MWE2 Workflow, I get the following errors:

0    INFO  AbstractExpressionsUsingWorkflowComponent - No meta models configured, using JavaBeans as default.
75   ERROR Mwe2Launcher       - Problems running workflow workflow.NeuralNetworksGenerator: Couldn't find EClass for name 'System'.
java.lang.RuntimeException: Problems running workflow workflow.NeuralNetworksGenerator: Couldn't find EClass for name 'System'.
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:99)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:64)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:55)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
Caused by: org.eclipse.emf.mwe.core.WorkflowInterruptedException: Couldn't find EClass for name 'System'.
    at org.eclipse.xtext.mwe.SlotEntry.findEClasses(SlotEntry.java:135)
    at org.eclipse.xtext.mwe.SlotEntry.put(SlotEntry.java:91)
    at org.eclipse.xtext.mwe.AbstractReader.addModelElementsToContext(AbstractReader.java:95)
    at org.eclipse.xtext.mwe.Reader.invokeInternal(Reader.java:166)
    at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
    at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
    at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
    at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
    at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:97)
    ... 5 more

The example that I used to create my particularized workflow mwe2 file is taken from the Xpand reference manual.

This is the list of plug-in dependencies from the MANIFEST.MF file:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: my.neuralnetworks.generator.project
Bundle-SymbolicName: my.neuralnetworks.generator.project; singleton:=true
Bundle-Version: 1.0.0
Require-Bundle: org.eclipse.jdt.core;bundle-version="3.5.0",
 org.eclipse.xtend.profiler;resolution:=optional,
 org.apache.commons.logging,
 org.apache.log4j;resolution:=optional,
 com.ibm.icu;bundle-version="4.0.1",
 org.antlr.runtime;bundle-version="3.0.0",
 org.eclipse.core.runtime;bundle-version="3.5.0",
 org.eclipse.emf.mwe.utils;bundle-version="0.7.0",
 org.eclipse.emf.ecore.xmi;bundle-version="2.5.0",
 org.eclipse.jface.text;bundle-version="3.5.0",
 org.eclipse.xpand;bundle-version="0.7.0",
 org.eclipse.xtend;bundle-version="0.7.0",
 org.eclipse.xtend.typesystem.emf;bundle-version="0.7.0",
 org.eclipse.xtend.backend;bundle-version="1.0.0";resolution:=optional,
 org.eclipse.xtend.middleend.xpand;bundle-version="1.0.0";resolution:=optional,
 org.eclipse.xtend.middleend.xtend;bundle-version="1.0.0";resolution:=optional,
 neuralnetworks;bundle-version="1.0.0",
 org.xtext.example.neuralnetworks;bundle-version="1.0.0",
 org.eclipse.emf.ecore.xmi.source;bundle-version="2.7.0",
 org.eclipse.jface.text.source;bundle-version="3.7.0",
 org.antlr.runtime.source;bundle-version="3.2.0",
 org.antlr.runtime_3.1.b1;bundle-version="3.1.0",
 com.ibm.icu.source;bundle-version="4.4.2",
 org.eclipse.jdt.core.source;bundle-version="3.7.0",
 org.eclipse.emf.mwe2.launch;bundle-version="2.2.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: nn

The neuralnetworks plug-in refers to my gmf project for my graphical editor where the metamodel is found and the org.xtext.example.neuralnetworks is the one corresponding to my text editor.

The ecore file corresponding to the emf file does have the EClass System in it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倥絔 2025-01-11 14:12:58

你的 dsl 是什么样子的?它包含一个名为 System 的 EClass 吗?
更新:刚刚看到您没有基于 Xtext 的元模型。因此,如果您想使用 Xtext Mwe Reader 组件,您必须使用 AbstractGenericResourceSupport 并注册您的 epackage,正如 Xtend2 示例中所述 http://christiandietrich.wordpress.com/2011/07/29/xtend2-code-generators-with-non-xtext-models/

How does your dsl look like? Does it contain a EClass named System?
Update: Just saw you do not have a Xtext based metamodel. So if you want to use the Xtext Mwe Reader Component you have to use a AbstractGenericResourceSupport and register your epackage as well as it is described in this Xtend2 example http://christiandietrich.wordpress.com/2011/07/29/xtend2-code-generators-with-non-xtext-models/

厌味 2025-01-11 14:12:58

否,但由于您使用现有元模型而不是派生元模型,因此您应该将以下内容添加到工作流程的开头

bean = StandaloneSetup {
    registerGeneratedEPackage = "sample.SamplePackage"
}

No, but since you use a existing metamodel and not a derived one you should add the following to the beginning of your workflow

bean = StandaloneSetup {
    registerGeneratedEPackage = "sample.SamplePackage"
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文