Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » dsl changes break incremental maven build
dsl changes break incremental maven build [message #1871595] Tue, 01 October 2024 13:47 Go to next message
Sören Rex is currently offline Sören RexFriend
Messages: 2
Registered: October 2024
Junior Member
Hello,

we have a Xtext dsl based application which is build continuously using maven. The xtext-maven-plugin is configured with <incrementalXtextBuild>true</incrementalXtextBuild> and maven runs without clean. When the dsl changes, the build is broken due to
Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.emf.ecore.EClass.getFeatureCount()" because "eClassData.eClass" is null
    at org.eclipse.emf.ecore.resource.impl.BinaryResourceImpl$EObjectInputStream.initEClassData (BinaryResourceImpl.java:2122)
    at org.eclipse.emf.ecore.resource.impl.BinaryResourceImpl$EObjectInputStream.readEClass (BinaryResourceImpl.java:2113)
    at org.eclipse.emf.ecore.resource.impl.BinaryResourceImpl$EObjectInputStream.readEStructuralFeature (BinaryResourceImpl.java:2128)
    at org.eclipse.xtext.builder.standalone.incremental.ExtendedEObjectInputStream.readReferenceDescriptions (ExtendedEObjectInputStream.java:135)
    at org.eclipse.xtext.builder.standalone.incremental.ExtendedEObjectInputStream.readResourceDescription (ExtendedEObjectInputStream.java:91)
    at org.eclipse.xtext.builder.standalone.StandaloneBuilderState.readResourceDescriptions (StandaloneBuilderState.java:310)
    at org.eclipse.xtext.builder.standalone.StandaloneBuilderState.read (StandaloneBuilderState.java:277)
    at org.eclipse.xtext.builder.standalone.StandaloneBuilderState.from (StandaloneBuilderState.java:255)
    at org.eclipse.xtext.builder.standalone.StandaloneBuilder.readOrCreateBuilderState (StandaloneBuilder.java:338)
    at org.eclipse.xtext.builder.standalone.StandaloneBuilder.launch (StandaloneBuilder.java:216)
    at org.eclipse.xtext.maven.AbstractXtextGeneratorMojo.internalExecute (AbstractXtextGeneratorMojo.java:191)
    at org.eclipse.xtext.maven.AbstractXtextGeneratorMojo.execute (AbstractXtextGeneratorMojo.java:163)
(In this case an EClass' name changed.)

Would it be possible to make org.eclipse.xtext.builder.standalone.StandaloneBuilder.readOrCreateBuilderState() more resilient by catching RuntimeException when reading old xtext.state and continue by creating a new StandaloneBuilderState ?
I have no idea, whether the output and stub directories have to be processed in this case too.
Re: dsl changes break incremental maven build [message #1871598 is a reply to message #1871595] Tue, 01 October 2024 14:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14722
Registered: July 2009
Senior Member
can you create a github issue

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: dsl changes break incremental maven build [message #1871706 is a reply to message #1871598] Sat, 05 October 2024 05:30 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7676
Registered: July 2009
Senior Member
I think you expect too much of Xtext. A prerequisite of modeling is stable metamodels.
In the past, any change and all bets were off. EMF has improved so that a stale Resource can be unloaded, setting proxies all round, then reloaded. However the refresh of all derived state such as caches is suspect. I doubt that every Xtext cache updates incrementally and I certainly doubt that it is a tested use case.
If you want to change metamodels, you should prefix your build with a has-metamodel-changed step to force a full build.
Re: dsl changes break incremental maven build [message #1871718 is a reply to message #1871706] Sun, 06 October 2024 09:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14722
Registered: July 2009
Senior Member
I guess a solution would be to do a full build as Xtext does it in eclipse in case the index cannot be recovered

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: dsl changes break incremental maven build [message #1871733 is a reply to message #1871718] Mon, 07 October 2024 12:31 Go to previous messageGo to next message
Sören Rex is currently offline Sören RexFriend
Messages: 2
Registered: October 2024
Junior Member
Yes, the idea was to continue the maven build by creating a new index. But I don't know, whether in this still intentional incremental Xtext build, the stub and output directories have to be processed or not.
Re: dsl changes break incremental maven build [message #1871745 is a reply to message #1871733] Tue, 08 October 2024 04:05 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14722
Registered: July 2009
Senior Member
please create a github issue.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Previous Topic:Trying to create boolean logic
Next Topic: Call To Action: Secure the future maintenance of Xtext
Goto Forum:
  


Current Time: Fri Oct 11 08:21:55 GMT 2024

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

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

Back to the top