Hi,
I am trying to generate a sitemap.xml file for my XWiki. Well, more specifically, for a sub wiki on that wiki farm.
I’ve created code (velocity) before to dynamically list pages and other tasks, so that part is fine (for the most part, I can prob. figure out what I need).
What I am totally new to / unsure is how to create/write to /replace (on updates) a sitemap.xml file that will be accessible externally (someone else will be building a sitemap index of a bunch of sitemaps, including mine).
Now, I’ve had a look already at the examples found here and though “yay, I’m done with example #2”… but then it does not run as-is.
I’ve only ever used Velocity (and still relatively new to it), not Groovy, so I’m not sure what to look for/fix and have been googling for a while and found nothing helpful… ![]()
The error I am currently getting is “Failed to execute the [groovy] macro. Cause: [startup failed: Script61.groovy: 26: expecting ‘}’, found ‘content’ @ line 26, column 15. w.println content ^ 1 error ].”. I’m using the example 2 linked above as-is with no modification (simply placed it in {{groovy}} & {{/groovy}} tags). The amount of “{” & “}” seems to match. Unsure what to fix in this script to make it run.
Also, I’ve tried just some other stuff quickly, poking around, such as:
{{groovy}}
filename = 'sitemap.xml'
File file = new File("out.txt")
file.write "First line\n"
file << "Second line\n"
println file.text
{{/groovy}}
I get the following error from it: “Failed to execute the [groovy] macro. Cause: [out.txt (Permission denied)]. Click on this message for details.”
So, all being said, I need some guidance in creating a file that will be accessible afterwards (ex: sitemap.xml) externally as a raw XML file (not an XWiki page).
Sincerely,
The user you’ve used to start your servlet container is not allowed to output to the current directory used to start the servlet container. You should specify a full path or change permissions.