Using maven to test an Xtext DSL to Java generator [message #1076503] |
Wed, 31 July 2013 13:42 |
Hallvard Traetteberg Messages: 673 Registered: July 2009 Location: Trondheim, Norway |
Senior Member |
|
|
Hi,
I have a DSL that uses Xbase with a generator that outputs Java classes.
The DSL may reference existing Java classes. To test the generator I
have written Junit tests that test the generated classes. E.g. from DSL
file A.dsl I generate A.java which is tested with ATest.java.
I'm now trying to get maven to execute these tests. The idea is to first
run the mwe generator workflow (using the fornax maven plugin), and then
compile the generated Java and the test classes, before executing the
tests. This works for self-contained DSL files, but not when they
reference java files.
In my current setup, the referenced java files are compiled in the
normal compile phase, then the mwe workflow is executed in the
generate-test-sources phase. These two steps seems to be triggered
correctly, but the compiled files from the compile phase end up in the
target directory, which apparently isn't visible to (on the classpath
of) the DSL when run from the mwe workflow.
Any suggestions?
Hallvard
|
|
|
|
Re: Using maven to test an Xtext DSL to Java generator [message #1077129 is a reply to message #1076560] |
Thu, 01 August 2013 09:25 |
Hallvard Traetteberg Messages: 673 Registered: July 2009 Location: Trondheim, Norway |
Senior Member |
|
|
Karsten,
Thanks for your comment! If I understand you correctly, I cannot use a
different phase in the same module, then. When you write module, you in
practice mean a separate Eclipse project, like my.dsl.tests.util, with
its own pom? Should this be an eclipse-plugin project or something else?
I don't want it packaged or deployed, I just need its (compiled) result
available for the my.dsl.tests project.
Hallvard
On 31.07.13 17.21, Karsten Thoms wrote:
> Your Java files must be compiled first in a seperate module. Then add a
> dependency to this module. This way your Java classes get accessible
> while executing the workflow.
|
|
|
Re: Using maven to test an Xtext DSL to Java generator [message #1077319 is a reply to message #1077129] |
Thu, 01 August 2013 14:25 |
Hallvard Traetteberg Messages: 673 Registered: July 2009 Location: Trondheim, Norway |
Senior Member |
|
|
For the record, here's the setup that worked:
my.dsl.tests.util contains sources that the DSL models refers to. This
project is an ordinary plugin project registered in the pom.xml as an
eclipse-plugin project
my.dsl.tests contains the DSL models that refer to types in
my.dsl.tests.util. In the pom it is registered as an
eclipse-test-plugin. The fornax maven plugin runs the mwe2 workflow
during the generate-test-sources phase before the normal operation of
the Tycho plugin kicks off the tests.
Hallvard
On 01.08.13 11.25, Hallvard Trætteberg wrote:
> Karsten,
>
> Thanks for your comment! If I understand you correctly, I cannot use a
> different phase in the same module, then. When you write module, you in
> practice mean a separate Eclipse project, like my.dsl.tests.util, with
> its own pom? Should this be an eclipse-plugin project or something else?
> I don't want it packaged or deployed, I just need its (compiled) result
> available for the my.dsl.tests project.
>
> Hallvard
>
> On 31.07.13 17.21, Karsten Thoms wrote:
>> Your Java files must be compiled first in a seperate module. Then add a
>> dependency to this module. This way your Java classes get accessible
>> while executing the workflow.
>
|
|
|
Powered by
FUDForum. Page generated in 0.03131 seconds