When i search for solution online i found this.
在上面的代码中,我认为它将帮助我实现我的解决方案,但我不知道如何在我当前的mwe2工作流程中添加上述代码。我尝试了他提到的但是我得到了例外所以我认为由于缺乏xtext知识我犯了错误
只是为了更多的了解,请参阅我的mwe2工作流程
language = StandardLanguage {
name = "com.herzog.pmide.RoutingLineINI"
fileExtensions = "ini"
referencedResource = "platform:/resource/com.herzog.pmide.routingline.xtext.model/model/pmrouting.genmodel"
fragment = ecore2xtext.Ecore2XtextValueConverterServiceFragment2 auto-inject {}
fragment = org.eclipse.xtext.generator.adapter.FragmentAdapter {
fragment = org.eclipse.xtext.generator.ecore2xtext.FormatterFragment {}
}
serializer = {
generateStub = false
}
validator = {
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
formatter = {
generateStub = true
}
scopeProvider = {
ignoreCase = true
}
parserGenerator = {
options = {
ignoreCase = true
}
}
}
通过上面的操作我得到如下例外
0 [main] INFO text.xtext.generator.XtextGenerator - Initializing Xtext generator
8 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Adding generated EPackage 'org.eclipse.xtext.common.types.TypesPackage'
476 [main] WARN lipse.emf.mwe.utils.StandaloneSetup - Skipping conflicting project ini4j at 'archive:file:/C:/Users/HUSER02/git/pm-ide_local4/com.herzog.pmide.tools.importutility/libs/ini4j-0.5.4.jar!/' and using 'archive:file:/C:/Users/HUSER02/git/pm-ide_local4/com.herzog.pmide.nl/libs/ini4j-0.5.4.jar!/' instead.
707 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project com.herzog.pmide.routingline.xtext at 'file:/C:/Users/HUSER02/git/pm-ide_local4/com.herzog.pmide.routingline.xtext/'
708 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project com.herzog.pmide.routingline.xtext.tests at 'file:/C:/Users/HUSER02/git/pm-ide_local4/com.herzog.pmide.routingline.xtext.tests/'
708 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project com.herzog.pmide.routingline.xtext.ide at 'file:/C:/Users/HUSER02/git/pm-ide_local4/com.herzog.pmide.routingline.xtext.ide/'
709 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project com.herzog.pmide.routingline.xtext.ui at 'file:/C:/Users/HUSER02/git/pm-ide_local4/com.herzog.pmide.routingline.xtext.ui/'
709 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project com.herzog.pmide.routingline.xtext.ui.tests at 'file:/C:/Users/HUSER02/git/pm-ide_local4/com.herzog.pmide.routingline.xtext.ui.tests/'
722 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Using resourceSet registry. The registered Packages will not be registered in the global EPackage.Registry.INSTANCE!
941 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/Xtext/Xbase/XAnnotations' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
944 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xtype' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
955 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xbase' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
955 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/common/JavaVMTypes' from 'platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel'
967 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://pmrouting/1.0' from 'platform:/resource/com.herzog.pmide.routingline.xtext.model/model/pmrouting.genmodel'
1830 [main] INFO text.xtext.generator.XtextGenerator - Generating com.herzog.pmide.RoutingLineINI
error(101): ../com.herzog.pmide.routingline.xtext/src-gen/com/herzog/pmide/parser/antlr/lexer/InternalRoutingLineINILexer.g:244:1: rule A_1 redefinition
error(101): ../com.herzog.pmide.routingline.xtext/src-gen/com/herzog/pmide/parser/antlr/lexer/InternalRoutingLineINILexer.g:246:1: rule B_1 redefinition
error(101): ../com.herzog.pmide.routingline.xtext/src-gen/com/herzog/pmide/parser/antlr/lexer/InternalRoutingLineINILexer.g:248:1: rule C_1 redefinition
error(101): ../com.herzog.pmide.routingline.xtext/src-gen/com/herzog/pmide/parser/antlr/lexer/InternalRoutingLineINILexer.g:250:1: rule D_1 redefinition
error(101): ../com.herzog.pmide.routingline.xtext/src-gen/com/herzog/pmide/parser/antlr/lexer/InternalRoutingLineINILexer.g:254:1: rule M_1 redefinition
error(101): ../com.herzog.pmide.routingline.xtext/src-gen/com/herzog/pmide/parser/antlr/lexer/InternalRoutingLineINILexer.g:256:1: rule P_1 redefinition
error(101): ../com.herzog.pmide.routingline.xtext/src-gen/com/herzog/pmide/parser/antlr/lexer/InternalRoutingLineINILexer.g:258:1: rule R_1 redefinition
error(101): ../com.herzog.pmide.routingline.xtext/src-gen/com/herzog/pmide/parser/antlr/lexer/InternalRoutingLineINILexer.g:260:1: rule S_1 redefinition
error(101): ../com.herzog.pmide.routingline.xtext/src-gen/com/herzog/pmide/parser/antlr/lexer/InternalRoutingLineINILexer.g:262:1: rule U_1 redefinition
error(101): ../com.herzog.pmide.routingline.xtext/src-gen/com/herzog/pmide/parser/antlr/lexer/InternalRoutingLineINILexer.g:264:1: rule W_1 redefinition
error(3): cannot find tokens file ..\com.herzog.pmide.routingline.xtext\src-gen\com\herzog\pmide\parser\antlr\internal\InternalRoutingLineINILexer.tokens
12930 [main] INFO text.xtext.generator.XtextGenerator - Generating common infrastructure
12957 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems running workflow com.herzog.pmide.GenerateRoutingLineINI:
[ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: XtextGenerator)
org.eclipse.xtext.util.RuntimeIOException: java.io.FileNotFoundException: C:\Users\HUSER02\git\pm-ide_local4\com.herzog.pmide.routingline.xtext\..\com.herzog.pmide.routingline.xtext\src-gen\com\herzog\pmide\parser\antlr\lexer\InternalRoutingLineINILexer.tokens (The system cannot find the file specified)
at org.eclipse.xtext.generator.JavaIoFileSystemAccess.readBinaryFile(JavaIoFileSystemAccess.java:241)
at org.eclipse.xtext.generator.AbstractFileSystemAccess2.readBinaryFile(AbstractFileSystemAccess2.java:37)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2$3.getAntlrTokenFile(AbstractAntlrGeneratorFragment2.java:331)
at org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider.getTokenDefMap(AntlrTokenDefProvider.java:46)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.cleanupParserTokensFile(AbstractAntlrGeneratorFragment2.java:341)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.runAntlr(XtextAntlrGeneratorFragment2.java:355)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.generateProductionGrammar(XtextAntlrGeneratorFragment2.java:234)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.doGenerate(XtextAntlrGeneratorFragment2.java:167)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.generate(AbstractAntlrGeneratorFragment2.java:117)
at org.eclipse.xtext.xtext.generator.CompositeGeneratorFragment2.generate(CompositeGeneratorFragment2.java:48)
at org.eclipse.xtext.xtext.generator.XtextGenerator.invokeInternal(XtextGenerator.java:202)
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:102)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: java.io.FileNotFoundException: C:\Users\HUSER02\git\pm-ide_local4\com.herzog.pmide.routingline.xtext\..\com.herzog.pmide.routingline.xtext\src-gen\com\herzog\pmide\parser\antlr\lexer\InternalRoutingLineINILexer.tokens (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at org.eclipse.xtext.generator.JavaIoFileSystemAccess.readBinaryFile(JavaIoFileSystemAccess.java:239)
... 20 more
java.lang.RuntimeException: Problems running workflow com.herzog.pmide.GenerateRoutingLineINI:
[ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: XtextGenerator)
org.eclipse.xtext.util.RuntimeIOException: java.io.FileNotFoundException: C:\Users\HUSER02\git\pm-ide_local4\com.herzog.pmide.routingline.xtext\..\com.herzog.pmide.routingline.xtext\src-gen\com\herzog\pmide\parser\antlr\lexer\InternalRoutingLineINILexer.tokens (The system cannot find the file specified)
at org.eclipse.xtext.generator.JavaIoFileSystemAccess.readBinaryFile(JavaIoFileSystemAccess.java:241)
at org.eclipse.xtext.generator.AbstractFileSystemAccess2.readBinaryFile(AbstractFileSystemAccess2.java:37)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2$3.getAntlrTokenFile(AbstractAntlrGeneratorFragment2.java:331)
at org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider.getTokenDefMap(AntlrTokenDefProvider.java:46)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.cleanupParserTokensFile(AbstractAntlrGeneratorFragment2.java:341)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.runAntlr(XtextAntlrGeneratorFragment2.java:355)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.generateProductionGrammar(XtextAntlrGeneratorFragment2.java:234)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.doGenerate(XtextAntlrGeneratorFragment2.java:167)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.generate(AbstractAntlrGeneratorFragment2.java:117)
at org.eclipse.xtext.xtext.generator.CompositeGeneratorFragment2.generate(CompositeGeneratorFragment2.java:48)
at org.eclipse.xtext.xtext.generator.XtextGenerator.invokeInternal(XtextGenerator.java:202)
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:102)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: java.io.FileNotFoundException: C:\Users\HUSER02\git\pm-ide_local4\com.herzog.pmide.routingline.xtext\..\com.herzog.pmide.routingline.xtext\src-gen\com\herzog\pmide\parser\antlr\lexer\InternalRoutingLineINILexer.tokens (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at org.eclipse.xtext.generator.JavaIoFileSystemAccess.readBinaryFile(JavaIoFileSystemAccess.java:239)
... 20 more
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:104)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: java.lang.RuntimeException:
[ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: XtextGenerator)
org.eclipse.xtext.util.RuntimeIOException: java.io.FileNotFoundException: C:\Users\HUSER02\git\pm-ide_local4\com.herzog.pmide.routingline.xtext\..\com.herzog.pmide.routingline.xtext\src-gen\com\herzog\pmide\parser\antlr\lexer\InternalRoutingLineINILexer.tokens (The system cannot find the file specified)
at org.eclipse.xtext.generator.JavaIoFileSystemAccess.readBinaryFile(JavaIoFileSystemAccess.java:241)
at org.eclipse.xtext.generator.AbstractFileSystemAccess2.readBinaryFile(AbstractFileSystemAccess2.java:37)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2$3.getAntlrTokenFile(AbstractAntlrGeneratorFragment2.java:331)
at org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider.getTokenDefMap(AntlrTokenDefProvider.java:46)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.cleanupParserTokensFile(AbstractAntlrGeneratorFragment2.java:341)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.runAntlr(XtextAntlrGeneratorFragment2.java:355)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.generateProductionGrammar(XtextAntlrGeneratorFragment2.java:234)
at org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2.doGenerate(XtextAntlrGeneratorFragment2.java:167)
at org.eclipse.xtext.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment2.generate(AbstractAntlrGeneratorFragment2.java:117)
at org.eclipse.xtext.xtext.generator.CompositeGeneratorFragment2.generate(CompositeGeneratorFragment2.java:48)
at org.eclipse.xtext.xtext.generator.XtextGenerator.invokeInternal(XtextGenerator.java:202)
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:102)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: java.io.FileNotFoundException: C:\Users\HUSER02\git\pm-ide_local4\com.herzog.pmide.routingline.xtext\..\com.herzog.pmide.routingline.xtext\src-gen\com\herzog\pmide\parser\antlr\lexer\InternalRoutingLineINILexer.tokens (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at org.eclipse.xtext.generator.JavaIoFileSystemAccess.readBinaryFile(JavaIoFileSystemAccess.java:239)
... 20 more
at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.handleIssues(Mwe2Bridge.java:56)
at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:48)
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:102)
... 4 more
感谢您阅读我的问题。
答案 0 :(得分:0)
使用新工作流程使用案例使用语言
language = StandardLanguage {
name = "org.xtext.example.mydsl1.MyDsl"
fileExtensions = "mydsl1"
serializer = {
generateStub = false
}
validator = {
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
scopeProvider = {
ignoreCase = true
}
parserGenerator = {
options = {
ignoreCase = true
}
}
}