Accelleo project does not recompile changed Java code [message #1782201] |
Tue, 20 February 2018 11:47  |
Eclipse User |
|
|
|
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 #1782273 is a reply to message #1782247] |
Wed, 21 February 2018 07:56   |
Eclipse User |
|
|
|
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 #1782357 is a reply to message #1782351] |
Thu, 22 February 2018 10:33   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05007 seconds