Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Accelleo project does not recompile changed Java code
Accelleo project does not recompile changed Java code [message #1782201] Tue, 20 February 2018 11:47 Go to next message
Frank Poppen is currently offline Frank PoppenFriend
Messages: 21
Registered: February 2018
Junior Member
I'm following the tutorial (https://wiki.eclipse.org/Acceleo/Getting_Started) and things are working fine. I build a wrapper for my own Java Service which also works fine. May Java looks like:

package TOOLING_GenSystemC.services;

public class UML2Services {
	public String myTestAgain(String toBeParsed){
		return toBeParsed.concat("_test1");
	}
}


The wrapper looks like:

[query public myTestAgain(arg0 : String) : String
	= invoke('TOOLING_GenSystemC.services.UML2Services', 'myTestAgain(java.lang.String)', Sequence{arg0})
/]


And I call it like:

[let result : String = myTestAgain('TEST1')]
	[result/]
[/let]


The result is as expected: 'TEST1_test1' as my Java receives the string from the template ('TEST1') and concats its own string to it ('_test1') and returns the result.

NOW THE PROBLEM:
If I change the template call to 'TEST2' and also I change my Java code to "_test2" I receive: 'TEST2_test1'

ANALYSIS:
The change in the .mtl code is recognized, but the Java change remains unchanged. Java is not recompiled.
But! : If I check the 'bin' dir for the '.class' file generated from the '.java' I see that the date has changed. I can also delete the entire 'bin' dir or use Project->clean, to have it completely re-generated. Still my java behaves as before and will answer with '_test1' even though I changed it to 'return toBeParsed.concat("_test2");'

Yes, I checked autobuild is on. That does not seem the problem. As I said I deleted all possible files from the build that I can think of and they are all re generated including the according '.class'

Where does the Accelleo project get the outdated information (Java Code) from and how can I force it to recompile?
Re: Accelleo project does not recompile changed Java code [message #1782245 is a reply to message #1782201] Tue, 20 February 2018 20:10 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7675
Registered: July 2009
Senior Member
Hi

This all sounds familiar. IIRC it was due to an incomplete change.

Since you only list the changes you claim to have made, I can do no more than assure you that you missed one.

Regards

Ed Willink
Re: Accelleo project does not recompile changed Java code [message #1782247 is a reply to message #1782245] Tue, 20 February 2018 20:23 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7675
Registered: July 2009
Senior Member
Hi

IIRC when I last used Acceleo five years ago, toggling the binary/ascii MTL preference was interesting and there is a magic line in build.properties that can be commented/uncommented.

Regards

Ed Willink
Re: Accelleo project does not recompile changed Java code [message #1782273 is a reply to message #1782247] Wed, 21 February 2018 07:56 Go to previous messageGo to next message
Frank Poppen is currently offline Frank PoppenFriend
Messages: 21
Registered: February 2018
Junior Member
Thanks, I will have a look at that today!

In the meantime FYI I noticed, that Closing Eclipse and starting does "solve" the Problem. Like I said: "Clean", "Deleting the Files (+Clean)", "Refresh", ... none did the trick. I can ignore all of this. I just need to restart Eclipse and tadaaa. Of course restarting after each change is not an option I'm going to go. Will have a look at your suggestions and come back here. Thanks!!
Re: Accelleo project does not recompile changed Java code [message #1782351 is a reply to message #1782273] Thu, 22 February 2018 10:02 Go to previous messageGo to next message
Mad Vin is currently offline Mad VinFriend
Messages: 40
Registered: September 2013
Member
Hello,

I have this same annoying problem.
Like said Franck, the only solution I've found is to restart Eclipse, but this is annoying too.

If you find a convenient solution, thank you to share it. ;)

Regards.
Re: Accelleo project does not recompile changed Java code [message #1782357 is a reply to message #1782351] Thu, 22 February 2018 10:33 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7675
Registered: July 2009
Senior Member
Hi

This all seems very reminiscent of https://bugs.eclipse.org/bugs/show_bug.cgi?id=363651 which forced me to reject all Acceleo progress after 3.1.2. but the problem appeared to be fixed by a rewrite for 3.3M7.

My "harder to force a rebuild" gives few clues as to how I succeeded, beyond checking file dates in the bin folder to see whether a build actually happened.

Other than restarting Eclipse I can only offer the following suggestions:
- make sure the Acceleo nature/builder precedes the Java nature/builder in the .project file.
- reopen the mtl editor
- add/remove a dummy template from the mtl file
- delete the bin folder (using the navigator View), refresh and build the project explicitly
- edit a public declaration in a dummy Java file that is imported by the generated template
- toggle the ascii/binary emtl representation, building between each toggle (I preferred the ASCII so that I could read it)

Regards

Ed Willink
Re: Accelleo project does not recompile changed Java code [message #1782544 is a reply to message #1782357] Mon, 26 February 2018 10:31 Go to previous messageGo to next message
Frank Poppen is currently offline Frank PoppenFriend
Messages: 21
Registered: February 2018
Junior Member
I got some thing new here. But first my feedback on the last comments:

As I tried to explain, I'm pretty sure that the java is always being compiled. In the end I ended up in deleteinh the entire "bin" branch from the file system. After a "clean" in the Acceleo project the entire "bin" branch is recreated and I have a brand new .class file available from my Java. But as it seems, this class is not used during runtime unless I restart Eclipse. This is as if "something" (some process/plugin) has still loaded/linked the old .class and forgets to have a look on the disc to find the change.

Solution:
I believe the problem to be with the "Runner: Acceleo Plug-in Application". I believe this might be the part holding a link to the outdated code.
I changed my configuration to (right-click main.mtl) Runs As -> Run Configuration :: Acceleo Application -> Main :: Runner: Java Application (NOT Acceleo Plug-in Application)
With this change everything works as expected. Yeah!

Question:
Why/when would I use the Acceleo Plug-in Application?
Re: Accelleo project does not recompile changed Java code [message #1782545 is a reply to message #1782544] Mon, 26 February 2018 10:32 Go to previous messageGo to next message
Frank Poppen is currently offline Frank PoppenFriend
Messages: 21
Registered: February 2018
Junior Member
I got some thing new here. But first my feedback on the last comments:

As I tried to explain, I'm pretty sure that the java is always being compiled. In the end I ended up in deleteing the entire "bin" branch from the file system. After a "clean" in the Acceleo project the entire "bin" branch is recreated and I have a brand new .class file available from my Java. But as it seems, this class is not used during runtime unless I restart Eclipse. This is as if "something" (some process/plugin) has still loaded/linked the old .class and forgets to have a look on the disc to find the change.

Solution:
I believe the problem to be with the "Runner: Acceleo Plug-in Application". I believe this might be the part holding a link to the outdated code.
I changed my configuration to (right-click main.mtl) Runs As -> Run Configuration :: Acceleo Application -> Main :: Runner: Java Application (NOT Acceleo Plug-in Application)
With this change everything works as expected. Yeah!

Question:
Why/when would I use the Acceleo Plug-in Application?

[Updated on: Mon, 26 February 2018 11:31]

Report message to a moderator

Re: Accelleo project does not recompile changed Java code [message #1782547 is a reply to message #1782545] Mon, 26 February 2018 10:38 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7675
Registered: July 2009
Senior Member
Hi

As Laurent explained on another thread the "Acceleo Plug-in Application" launch is broken and should have been removed. If you use it expect to have trouble.

Regards

Ed Willink
Re: Accelleo project does not recompile changed Java code [message #1782548 is a reply to message #1782545] Mon, 26 February 2018 10:39 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hello Frank,

This issue you're having is the same as the one Mad Vin is encountering on the other active thread : https://www.eclipse.org/forums/index.php/m/1782546/#msg_1782546. Basically, the "Acceleo Plug-in Application" runner is something that should no longer be available since it's no longer functional because of changes in the eclipse platform. It will be removed shortly, and the "Java Application" kind is really what you need to be using.

Laurent Goubet
Obeo
Re: Accelleo project does not recompile changed Java code [message #1782552 is a reply to message #1782548] Mon, 26 February 2018 11:34 Go to previous messageGo to next message
Frank Poppen is currently offline Frank PoppenFriend
Messages: 21
Registered: February 2018
Junior Member
Ok, then this issue is solved. Great!

The tutorial needs an update though (https://wiki.eclipse.org/Acceleo/Getting_Started) it is still showing the plugin and this is the very first resource for newbies.

[Updated on: Mon, 26 February 2018 11:35]

Report message to a moderator

Re: Accelleo project does not recompile changed Java code [message #1782555 is a reply to message #1782552] Mon, 26 February 2018 12:53 Go to previous messageGo to next message
Mad Vin is currently offline Mad VinFriend
Messages: 40
Registered: September 2013
Member
Hi !

Yes, it seems very similar to the problem I've remarked with the Java classes and the Acceleo runner (like said Laurent). It's as if the Acceleo runner uses a cache to load the Java classes, that is not updated if the Java classes are modified in the same session of Eclipse.

Regards.
Re: Accelleo project does not recompile changed Java code [message #1782628 is a reply to message #1782555] Tue, 27 February 2018 09:44 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Thanks for the heads-up Frank. I'll try and update the getting started asap.
Re: Accelleo project does not recompile changed Java code [message #1782708 is a reply to message #1782628] Wed, 28 February 2018 08:12 Go to previous message
Frank Poppen is currently offline Frank PoppenFriend
Messages: 21
Registered: February 2018
Junior Member
DELETED (Sorry, posted to wrong issue)

[Updated on: Wed, 28 February 2018 08:16]

Report message to a moderator

Previous Topic:[Acceleo]
Next Topic:Is Accello mature enough for a productive environment?
Goto Forum:
  


Current Time: Mon Oct 07 14:47:25 GMT 2024

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

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

Back to the top