Question: Is there a way to perform the "generate model" (build model) task using an ANT script?
Background: Occasionally the ExternalModelProperties and Portlet xml files become out of sync, and we've found the only way to get it back in sync, is to delete them, and then open every .model file, and click the "generate model" button for each one. Then, after publishing, everything seems to be fixed. We've found that this happens most often after we sync our code from SVN. This can be a real pain with 15+ model files.
So what I would like to do, is store only the .model files (and associated html/script/css/etc) in SVN and not the generated java code. Then, after we sync, we could hit an ANT script that would re-create the generated java files/ExternalModelProperties, etc.
Is what I'm looking to do possible? I was thinking ANT, but I'm open to ideas.
Pinned topic Perform generate model task using an ANT script
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-01-07T22:01:02Z at 2013-01-07T22:01:02Z by DunnoJack
mburati 060000VQ202582 Posts
Re: Perform generate model task using an ANT script2013-01-02T15:38:30ZThis is the accepted answer. This is the accepted answer.Obviously, something doesn't seem right there, you shouldn't have to do all those steps on a regular basis (if at all) afaik.
The WEF source control / team developpment documentation recommends not storing any generated artifacts in source control (since they can be, and are regenerated on each build), so if you're storing portlet.xml and/or ExternalModelProperties.xml in source control, that may be contributing to the odd behavior that you are seeing.
You shouldn't typically have to open a model, explicitly genrate it and save it, to update the external model properties, unless the code associated with a builder has changed to store NEW external model properties since the last time that model was generated/saved in the designer, which doesn't happen often. The model properties associated with the builders in the model are stored in the model XML itself in an external model properties XML element at the bottom of the model.
ExternalModelProperties is generated when WEF code asks for a list of models with various types of properties (eg, all models enabeld as portlets via Portlet Adapter, all models with Cooperative Portlet builders etc), and I believe it checks timestamps to avoid having to scan every model for properties every time (instead looking for changes since the last time it generated) so if the clocks are way off on your various dev systems, that could contribute to odd behavior.
If you delete ExternalModelProperties.xml then it should be regenerated the next time you generate a portlet WAR from WEF (with the Designer and/or with the WEF provided ant based command line portlet WAR task). The portlet.xml file should be generated every time you execute that task to generate a portlet WAR.
I hope that info helps,
The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
DunnoJack 270005994032 Posts
Re: Perform generate model task using an ANT script2013-01-07T22:01:02ZThis is the accepted answer. This is the accepted answer.
- mburati 060000VQ20
Our issue isn't on a regular basis, but probably once a week. Unfortunately I don't have exact steps on how to reproduce the issue either. Don't you love troubleshooting issues like that? ;)
Based on what you've said though, I'm going to try a different approach the next time this happens.
I'll use ANT to remove the externalModelProperties and Portlet.xml files, and then "touch" each of the .model files to update their last modified dates. This will force the two xml files to be re-created when generating the WAR file in WEF, while accounting for ll of the model files.
Our current project has 47 model files... so we are definitely pushing the system.