On Jan 30, 2012, at 8:24 AM, Paul Libbrecht wrote:
Hello fellow XWikiers,
I am regularly working with my favorite IDE, IntelliJ IDEA, and it is doing a very good
work for me to edit velocity and groovy. I am using this also for the source of wiki pages
which I upload using a tiny upload script (that posts like a form using curl and simple
preemptive authentication, [1]).
The interest of storing page-sources as files is that you get all the IDE services (it
could work with most IDEs) such as auto-completion, code-usage-tracking, or html and
javascript validation.
The other interest is that my source files enter versioning. I can commit these so that I
and other developers know it's part of the build for the future, independently of my
server upload and developer readable in versioning system.
Yep, we already save our XAR pages in our SCM in the xwiki project dev.
Thus far I've been using
wiki/src/main/pages/<spaceName>/<pageName>.vm (or .grv, .properties, ...).
There's a single issue I stumble across: for IntelliJ to do me classpath resolution
(e.g. recognize an import for the Context class), I need to change the maven project type
from xar to jar. And this is not so good.
My next step would thus be to create a new sub-project, xwikipages, containing these
pages... but maybe everything is wrong here.
My questions:
• how much of that is good or best practice?
• what do others use as IDE-exploitation for XWiki-pages? (XEclipse and the Git
xwiki-application?)
• is anyone else interested into sharing such a practice and enhance it commonly?
Personally I'd love to have an IDE plugin (for intellij IEA for example; )) that would
take a file in XWiki XML format and displays the content as editable text. When saved, it
would be saved in the XWiki XML format with proper XML-encoding.
An alternative which might be even better (since it would work with all IDEs and I think
this is what you're proposing) would be to do something like this:
* Store XAR pages into 2 files:
** one file for the content itself saved without XML-encoding, as plain text
** another file containing the metadata
* Modify our XAR plugin so that it combines the 2 files into one XML file in the XWiki XML
file format when it generates the XAR.
* Adding a Mojo so that the user can upload a given page into a running instance would be
the icing on the cake.
* We'll also need another mojo that takes an existing XAR and extracts it and split
pages into the 2 files mentioned above.
The issue you have with classpath resolution is probably not so hard to fix. I'll need
to try this out to try to find a solution.
Definitely +1 from me to explore such ideas. The best IMO Paul would be to continue the
work we started with the XAR plugin.
Thanks
-Vincent