Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » SAXParseException on running Maven build for test that builds an Xtext model
SAXParseException on running Maven build for test that builds an Xtext model [message #1006704] Fri, 01 February 2013 13:55 Go to next message
Latha Shankara is currently offline Latha ShankaraFriend
Messages: 33
Registered: June 2012
Member
Hi,

I get the below exception while running the maven build for a test,

ERROR WorkflowRunner     - org.xml.sax.SAXParseException: Content is not allowed in prolog.
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.xml.sax.SAXParseException: Content is not allowed in prolog.
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
        at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)


while the test runs fine when run as a Junit PluginTest.I pass new ResourceSetImpl() to a method which expects ResourceSet which then internally calls the methods mentioned in the stack trace. I also tried the code,

Injector injector = new MyModelStandaloneSetup().createInjectorAndDoEMFRegistration();
XtextResourceSet resourceSet = injector.getInstance(XtextResourceSet.class);


instead of creating a new object ResourceSetImpl but it does not build properly and the output is not generated.

Any hints on what the issue is?

Thanks in Advance,
Latha
Re: SAXParseException on running Maven build for test that builds an Xtext model [message #1648022 is a reply to message #1006704] Tue, 03 March 2015 18:36 Go to previous messageGo to next message
Ingo Mohr is currently offline Ingo MohrFriend
Messages: 14
Registered: September 2011
Junior Member
Hi Latha,

I have the same problem.

If I run my tests as junit tests, everything is fine. If I run them using maven tycho, I get the same SaxParseException "Content is not allowed in prolog."

Could you solve your problem?
Or anyone else?

Thx in adance,
Ingo
Re: SAXParseException on running Maven build for test that builds an Xtext model [message #1648039 is a reply to message #1648022] Tue, 03 March 2015 18:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 7414
Registered: July 2009
Senior Member
Hi Ingo,

can you please share a little complete example project.
btw do you know of the xtext way of unit tests (YourDslInjectorProvider + XtextRunner)
Re: SAXParseException on running Maven build for test that builds an Xtext model [message #1648074 is a reply to message #1648039] Tue, 03 March 2015 19:07 Go to previous message
Ingo Mohr is currently offline Ingo MohrFriend
Messages: 14
Registered: September 2011
Junior Member
Hi Christian,

stupid me. I didn't recognize the section on unit tests in the XText documentation: http://eclipse.org/Xtext/documentation.html "Unit Testing the Language".

My unitests were missing the annotations above the test class. Adding them solved my problem:

@InjectWith(DomainmodelInjectorProvider)
@RunWith(XtextRunner)
class TestSomeStuff {
}


Thanks anyway for the fast reply.
I should have looked better, though -.-

Ingo
Previous Topic:Using until operator without consuming the last token
Next Topic:FileNotFoundException by defining logical expressions in XText
Goto Forum:
  


Current Time: Thu Jul 30 14:19:58 GMT 2015

Powered by FUDForum. Page generated in 0.02465 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software