Monday 23 August 2010

Archiva gives the maven site plugin an invalid site_en.xml

I got the following nasty error since friday:

$ mvn -U -e -X clean site
...
[DEBUG] Reading site descriptor from /home/amanica/.m2/repository/za/co/my_company/super-pom/1.0.3/super-pom-1.0.3-site_en.xml
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] SiteToolException: Error parsing site descriptor

Expected root element 'project' but found 'html' (position: START_TAG seen ... Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r\n<html>... @8:7)
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: SiteToolException: Error parsing site descriptor
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: SiteToolException: Error parsing site descriptor
at org.apache.maven.plugins.site.AbstractSiteRenderingMojo.createSiteRenderingContext(AbstractSiteRenderingMojo.java:232)
at org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:137)
at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:120)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by: org.apache.maven.doxia.tools.SiteToolException: Error parsing site descriptor
at org.apache.maven.doxia.tools.DefaultSiteTool.readDecorationModel(DefaultSiteTool.java:1298)
at org.apache.maven.doxia.tools.DefaultSiteTool.getDecorationModel(DefaultSiteTool.java:1252)
at org.apache.maven.doxia.tools.DefaultSiteTool.getDecorationModel(DefaultSiteTool.java:1260)
at org.apache.maven.doxia.tools.DefaultSiteTool.getDecorationModel(DefaultSiteTool.java:511)
at org.apache.maven.plugins.site.AbstractSiteRenderingMojo.createSiteRenderingContext(AbstractSiteRenderingMojo.java:225)
... 21 more
Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: Expected root element 'project' but found 'html' (position: START_TAG seen ... Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">\r\n<html>... @8:7)
at org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Reader.parseDecorationModel(DecorationXpp3Reader.java:619)
at org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Reader.read(DecorationXpp3Reader.java:1387)
at org.apache.maven.doxia.site.decoration.io.xpp3.DecorationXpp3Reader.read(DecorationXpp3Reader.java:1401)
at org.apache.maven.doxia.tools.DefaultSiteTool.readDecorationModel(DefaultSiteTool.java:1294)

It turns out that maven looks for a site_en.xml for my parent project on archiva and archiva seems to generate a return file which is actually an error message.
The maven site plugin then tries to parse it and fails horribly :(
I worked around this by just adding the following content to src/site/site_en.xml in my parent project and everything was well!

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/DECORATION/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd">
<body>
</body>
</project>


I got really frustrated by this cryptic error message. I wanted to bash my head against the table and throw my laptop against the wall. Instead I cried out to God and not long after that I figured it out. Some would say thats just coincidence, I say: "Thank God", "Praise God" and "Why didn't I ask You sooner?".

Friday 20 August 2010

Chromium happy again

After getting the message below on each chromium start for months, I finally googled it:

Your profile could not be opened correctly.
Some features may be unavailable.
Please check that the profile exists and you have permission to read and write its contents.

The solution for me was simple:
rm ~/.config/chromium/Default/History




I can't believe I suffered so long with a broken awesomebar which never found new history :(
Previously I assumed its something broken in chromium that would get fixed by a newer Ubuntu packages. The fix never came so I'm really happy that I finally found the solution today:
see Ariel's solution.