fornax-oaw-m2-plugin extended generator [message #1017429] |
Mon, 11 March 2013 20:16 |
Artem G. Messages: 10 Registered: October 2012 |
Junior Member |
|
|
Hi folks,
I'm using fornax-oaw-m2-plugin to build my Xtext-DSL plugin with maven. There is a component in MWE2 workflow, which is my implementation of an extended generator for my DSL.
module org.example.GenerateTestDSL
import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*
var grammarURI = "classpath:/org/example/TestDSL.xtext"
var file.extensions = "testdsl"
var projectName = "org.example.testdsl"
var runtimeProject = "../${projectName}"
Workflow {
bean = StandaloneSetup {
scanClassPath = true
platformUri = "${runtimeProject}/.."
// The following two lines can be removed, if Xbase is not used.
registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
}
component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
}
component = DirectoryCleaner {
directory = "${runtimeProject}.ui/src-gen"
}
component = org.example.ExtendedGenerator {
srcPath = "/src/main/java"
srcGenPath = "/src/generated/java"
...
}
}
}
If I build the project using fornax-oaw-m2-plugin to run MWE2 workflow it is unable to resolve my extended generator class, if I place this extended generator class in the same package with MWE2 workflow and it is in classpath. If I start MWE2 workflow alone from eclipse -- all works fine. The problem is I think, fornax-oaw-m2-plugin needs compiled classes in generate-sources phase, but they get compiled in compile phase, which is after it.
I found a dirty solution: if I create new project, place extended generator class in it and add it as a dependency by fornax-oax-m2-plugin like this:
<plugin>
<groupId>org.fornax.toolsupport</groupId>
<artifactId>fornax-oaw-m2-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.example</groupId>
<artifactId>org.example.testdsl.postprocessor</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<configuration>
<workflowDescriptor>src/main/resources/org/example/GenerateTestDSL.mwe2</workflowDescriptor>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run-workflow</goal>
</goals>
</execution>
</executions>
</plugin>
I'm able to build it with maven, but I'm getting an error in Eclipse in MWE2 workflow file. It can't resolve the extended generator class. But sure, while it is in another project. I have tried to add this project as a dependency in the DSL pom.xml but MWE2 is unable to resolve it. It seams to me that MWE2 workflow use only MANIFEST.MF to resource dependencies. So what should I do to solve this issue: able to build MWE2 workflow with custom component with maven and no errors in eclipse. While extracting extended generator in separate project only to be able to build it with maven is a really dirty solution.
Thanks for help,
Artem.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03524 seconds