Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-14382

Failure to build the XAR modules if not cleaned first

    XMLWordPrintable

Details

    • Unknown
    • N/A
    • N/A

    Description

      To reproduce:

      • checkout xwiki-enterprise
      • cd xwiki-enterprise-ui/xwiki-enterprise-ui-admin-user/
      • mvn clean install
      • mvn install -e

      you should get:

      [ERROR] Failed to execute goal org.xwiki.commons:xwiki-commons-tool-xar-plugin:9.0-SNAPSHOT:xar (default-xar) on project xwiki-enterprise-ui-admin-user: Error while creating XAR file: Adding text to an XML document must not be null -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.xwiki.commons:xwiki-commons-tool-xar-plugin:9.0-SNAPSHOT:xar (default-xar) on project xwiki-enterprise-ui-admin-user: Error while creating XAR file
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
      	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
      	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
      	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Error while creating XAR file
      	at org.xwiki.tool.xar.XARMojo.execute(XARMojo.java:88)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
      	... 20 more
      Caused by: java.lang.IllegalArgumentException: Adding text to an XML document must not be null
      	at org.dom4j.DocumentFactory.createText(DocumentFactory.java:174)
      	at org.dom4j.tree.AbstractElement.addText(AbstractElement.java:899)
      	at org.dom4j.tree.AbstractElement.setText(AbstractElement.java:1120)
      	at org.xwiki.tool.xar.XARMojo.addFileElements(XARMojo.java:338)
      	at org.xwiki.tool.xar.XARMojo.toXML(XARMojo.java:276)
      	at org.xwiki.tool.xar.XARMojo.generatePackageXml(XARMojo.java:252)
      	at org.xwiki.tool.xar.XARMojo.addFilesToArchive(XARMojo.java:395)
      	at org.xwiki.tool.xar.XARMojo.performArchive(XARMojo.java:134)
      	at org.xwiki.tool.xar.XARMojo.execute(XARMojo.java:86)
      	... 22 more
      

      The reason is because the top level POM executes the remote-maven-resources plugin (to add licenses automatically) and the xwiki-enterprise pom depends on the xwiki-platform-distribution POM which has a pluginMgmt section defining another execution for the remote-maven-resources plugin and which copies several resources files such as hibernate.cfg.xml which ends up (for some reason I don't understand) in target/classes on the second build without the clean. Thus the XAR mojo tries to read it as a wiki page and stores a null page reference causing the message above to be output.

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: