gpt4 book ai didi

ant - 使用 ant : Generation of the Grammar classes fails 构建 xtext 项目时出错

转载 作者:行者123 更新时间:2023-12-04 22:26:31 28 4
gpt4 key购买 nike

我正在为我的学士论文的 eclipse 应用程序开发一个 xtext 插件项目。

我想在运行时使用执行 Mwe2Launcher 类的 ant 脚本执行“生成 Xtext 工件”,并在临时文件夹中进行生成。

我写了一个 Activator 在临时文件夹中创建一个项目文件夹并复制 mwe2 文件、我的语法文件和 ant 脚本。

执行 Ant 脚本会导致此错误:

osgi> start 360
gen:
[java] 0 INFO StandaloneSetup - Registering platform uri 'C:\Foo-test'
[java] 2461 INFO DirectoryCleaner - Cleaning C:\Foo-test\org.xtext.example.foobar\..\org.xtext.example.foobar\src-gen
[java] 2503 INFO DirectoryCleaner - Cleaning C:\Foo-test\org.xtext.example.foobar\..\org.xtext.example.foobar.ui\src-gen
[java] 3056 INFO LanguageConfig - generating infrastructure for org.xtext.example.foobar.Foo with fragments : ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment, EcoreGeneratorFragment, ParseTreeConstructorFragment, ResourceFactoryFragment, XtextAntlrGeneratorFragment, JavaValidatorFragment, ImportNamespacesScopingFragment, QualifiedNamesFragment, BuilderIntegrationFragment, GeneratorFragment, FormatterFragment, LabelProviderFragment, OutlineTreeProviderFragment, QuickOutlineFragment, QuickfixProviderFragment, JavaBasedContentAssistFragment, XtextAntlrUiGeneratorFragment, TypesGeneratorFragment, XbaseGeneratorFragment, CodetemplatesGeneratorFragment
[java] 6253 INFO GenModelHelper - Registered GenModel 'http://www.xtext.org/example/foobar/Foo' from 'file:/C:/Foo-test/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/Foo.genmodel'
[java] org.eclipse.emf.common.util.WrappedException: java.io.IOException: The path '/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/foo/FooPackage.java' is unmapped
[java] at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateJava(AbstractGeneratorAdapter.java:1112)
[java] at org.eclipse.emf.codegen.ecore.genmodel.generator.GenPackageGeneratorAdapter.generatePackageInterface(GenPackageGeneratorAdapter.java:467)
[java] at org.eclipse.emf.codegen.ecore.genmodel.generator.GenPackageGeneratorAdapter.generateModel(GenPackageGeneratorAdapter.java:219)
[java] at org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:221)
[java] at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:290)
[java] at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:617)
[java] at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:528)
[java] at org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment.doGenerate(EcoreGeneratorFragment.java:144)
[java] at org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment.generate(EcoreGeneratorFragment.java:211)
[java] at org.eclipse.xtext.generator.CompositeGeneratorFragment.generate(CompositeGeneratorFragment.java:81)
[java] at org.eclipse.xtext.generator.LanguageConfig.generate(LanguageConfig.java:108)
[java] at org.eclipse.xtext.generator.Generator.generate(Generator.java:352)
[java] at org.eclipse.xtext.generator.Generator.invokeInternal(Generator.java:126)
[java] at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
[java] at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
[java] at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
[java] at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
[java] at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
[java] at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:97)
[java] at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
[java] at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:76)
[java] at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
[java] Caused by: java.io.IOException: The path '/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/foo/FooPackage.java' is unmapped
[java] at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createOutputStream(PlatformResourceURIHandlerImpl.java:428)
[java] at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createOutputStream(ExtensibleURIConverterImpl.java:339)
[java] at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.createOutputStream(AbstractGeneratorAdapter.java:1440)
[java] at org.eclipse.emf.mwe2.ecore.CvsIdFilteringGeneratorAdapterFactoryDescriptor$IdFilteringGenModelGeneratorAdapterFactory$IdFilteringGenPackageAdapter.createOutputStream(CvsIdFilteringGeneratorAdapterFactoryDescriptor.java:39)
[java] at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateJava(AbstractGeneratorAdapter.java:1104)
[java] ... 21 more
[java] org.eclipse.emf.common.util.WrappedException: java.io.IOException: The path '/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/foo/Model.java' is unmapped
[java] at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateJava(AbstractGeneratorAdapter.java:1112)
[java] at org.eclipse.emf.codegen.ecore.genmodel.generator.GenClassGeneratorAdapter.generateInterface(GenClassGeneratorAdapter.java:123)
[java] at org.eclipse.emf.codegen.ecore.genmodel.generator.GenClassGeneratorAdapter.generateModel(GenClassGeneratorAdapter.java:106)
[java] at org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:221)
[java] at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:290)
[java] at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:617)
[java] at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:528)
[java] at org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment.doGenerate(EcoreGeneratorFragment.java:144)
[java] at org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment.generate(EcoreGeneratorFragment.java:211)
[java] at org.eclipse.xtext.generator.CompositeGeneratorFragment.generate(CompositeGeneratorFragment.java:81)
[java] at org.eclipse.xtext.generator.LanguageConfig.generate(LanguageConfig.java:108)
[java] at org.eclipse.xtext.generator.Generator.generate(Generator.java:352)
[java] at org.eclipse.xtext.generator.Generator.invokeInternal(Generator.java:126)
[java] at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
[java] at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
[java] at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
[java] at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
[java] at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
[java] at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:97)
[java] at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
[java] at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:76)
[java] at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
[java] Caused by: java.io.IOException: The path '/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/foo/Model.java' is unmapped
[java] at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createOutputStream(PlatformResourceURIHandlerImpl.java:428)
[java] at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createOutputStream(ExtensibleURIConverterImpl.java:339)
[java] at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.createOutputStream(AbstractGeneratorAdapter.java:1440)
[java] at org.eclipse.emf.mwe2.ecore.CvsIdFilteringGeneratorAdapterFactoryDescriptor$IdFilteringGenModelGeneratorAdapterFactory$IdFilteringGenClassAdapter.createOutputStream(CvsIdFilteringGeneratorAdapterFactoryDescriptor.java:73)
[java] at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateJava(AbstractGeneratorAdapter.java:1104)
[java] ... 21 more
[java] org.eclipse.emf.common.util.WrappedException: java.io.IOException: The path '/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/foo/Greeting.java' is unmapped
[java] at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateJava(AbstractGeneratorAdapter.java:1112)
[java] at org.eclipse.emf.codegen.ecore.genmodel.generator.GenClassGeneratorAdapter.generateInterface(GenClassGeneratorAdapter.java:123)
[java] at org.eclipse.emf.codegen.ecore.genmodel.generator.GenClassGeneratorAdapter.generateModel(GenClassGeneratorAdapter.java:106)
[java] at org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:221)
[java] at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:290)
[java] at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:617)
[java] at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:528)
[java] at org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment.doGenerate(EcoreGeneratorFragment.java:144)
[java] at org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment.generate(EcoreGeneratorFragment.java:211)
[java] at org.eclipse.xtext.generator.CompositeGeneratorFragment.generate(CompositeGeneratorFragment.java:81)
[java] at org.eclipse.xtext.generator.LanguageConfig.generate(LanguageConfig.java:108)
[java] at org.eclipse.xtext.generator.Generator.generate(Generator.java:352)
[java] at org.eclipse.xtext.generator.Generator.invokeInternal(Generator.java:126)
[java] at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
[java] at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
[java] at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
[java] at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
[java] at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
[java] at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:97)
[java] at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
[java] at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:76)
[java] at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
[java] Caused by: java.io.IOException: The path '/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/foo/Greeting.java' is unmapped
[java] at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createOutputStream(PlatformResourceURIHandlerImpl.java:428)
[java] at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createOutputStream(ExtensibleURIConverterImpl.java:339)
[java] at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.createOutputStream(AbstractGeneratorAdapter.java:1440)
[java] at org.eclipse.emf.mwe2.ecore.CvsIdFilteringGeneratorAdapterFactoryDescriptor$IdFilteringGenModelGeneratorAdapterFactory$IdFilteringGenClassAdapter.createOutputStream(CvsIdFilteringGeneratorAdapterFactoryDescriptor.java:73)
[java] at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateJava(AbstractGeneratorAdapter.java:1104)
[java] ... 21 more
[java] 6768 INFO EcoreGeneratorFragment - Diagnostic ERROR source=org.eclipse.emf.codegen.ecore code=0 Generating code data=[] [Diagnostic OK source=org.eclipse.emf.common code=0 OK data=[], Diagnostic OK source=org.eclipse.emf.common code=0 OK data=[], Diagnostic OK source=org.eclipse.emf.common code=0 OK data=[], Diagnostic OK source=org.eclipse.emf.common code=0 OK data=[], Diagnostic OK source=org.eclipse.emf.common code=0 OK data=[], Diagnostic ERROR source=org.eclipse.emf.codegen.ecore code=0 Generating Java interface org.xtext.example.foobar.foo.FooPackage failed with an unhandled exception data=[] [Diagnostic ERROR source=org.eclipse.emf.common code=0 IOException: The path '/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/foo/FooPackage.java' is unmapped data=[java.io.IOException: The path '/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/foo/FooPackage.java' is unmapped]], Diagnostic ERROR source=org.eclipse.emf.codegen.ecore code=0 Generating Java interface org.xtext.example.foobar.foo.Model failed with an unhandled exception data=[] [Diagnostic ERROR source=org.eclipse.emf.common code=0 IOException: The path '/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/foo/Model.java' is unmapped data=[java.io.IOException: The path '/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/foo/Model.java' is unmapped]], Diagnostic ERROR source=org.eclipse.emf.codegen.ecore code=0 Generating Java interface org.xtext.example.foobar.foo.Greeting failed with an unhandled exception data=[] [Diagnostic ERROR source=org.eclipse.emf.common code=0 IOException: The path '/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/foo/Greeting.java' is unmapped data=[java.io.IOException: The path '/org.xtext.example.foobar/src-gen/org/xtext/example/foobar/foo/Greeting.java' is unmapped]], Diagnostic OK source=org.eclipse.emf.common code=0 OK data=[], Diagnostic OK source=org.eclipse.emf.common code=0 OK data=[], Diagnostic OK source=org.eclipse.emf.common code=0 OK data=[], Diagnostic OK source=org.eclipse.emf.common code=0 OK data=[]]
[java] 10385 INFO JavaValidatorFragment - generating Java-based EValidator API
[java] 13246 INFO Workflow - Done. BUILD SUCCESSFUL Total time: 27 seconds

未映射的“.java”文件也未生成。整个“/src-gen/...../foobar/foo”文件夹丢失。

我想这就是原因,应该解决什么问题。

我真的不知道,问题出在哪里。我已经在 Eclipse forum 中进行了讨论在那里您可以找到 build.xml 但对于另一个项目,还有一个 Activator 类来激活插件并执行复制内容并执行 ant 脚本,您还可以找到我使用的 mwe2 文件。

最佳答案

您必须确保在工作流程中将临时文件夹注册为平台 URI。 Xtext 使用 EMF 的平台:/资源 URI 方案。因此,必须注册平台根目录,以便根据平台路径定义从文件系统上的绝对位置到逻辑位置的路径映射。您也可以尝试复制 .project 文件。如果您已经将临时文件夹注册为平台路径,我认为这会有所帮助。

关于ant - 使用 ant : Generation of the Grammar classes fails 构建 xtext 项目时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10079384/

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