Tuesday, February 05, 2008

Yes! Yes! Yes! XWiki build Successful!

After one day hard thinking and trying to solve maven build issues I managed to build the whole XWiki project using:

mvn -Dmaven.test.skip=true install -Pall

As you see I disabled unit tests. That's because some of them failed and build was exiting on fail. And, honestly, I didn't want to search for the option just to ignore test failures - it's easier to disable them :)

I encountered following problems during the building process:

Checkstyle errors

(why the f**k the whole build fails on checkstyle error?)

[INFO] There are 2 checkstyle errors.
[WARNING] Unable to locate Source XRef to link to - DISABLED
[DEBUG] File C:\Dev\XWiki\xwiki-platform-plugins\application-manager\target\site/checkstyle.rss created...
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-checkstyle-plugin:2.1:check' -->
[DEBUG] (f) failOnViolation = true
[DEBUG] (f) outputFile = C:\Dev\XWiki\xwiki-platform-plugins\application-manager\target\checkstyle-result.xml
[DEBUG] (f) outputFileFormat = xml
[DEBUG] -- end configuration --
[INFO] [checkstyle:check {execution: default}]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] You have 2 checkstyle violations.
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.BuildFailureException: You have 2 checkstyle violations.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:560)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
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.MojoFailureException: You have 2 checkstyle violations.
at org.apache.maven.plugin.checkstyle.CheckstyleViolationCheckMojo.execute(CheckstyleViolationCheckMojo.java:96)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
... 16 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35 seconds
[INFO] Finished at: Mon Feb 04 21:17:45 CET 2008
[INFO] Final Memory: 29M/53M
[INFO] ------------------------------------------------------------------------



My dummy workaround-solution was to disable (remove/comment out) checkstyle for buggy part :) i.e. xwiki-platform-plugins\application-manager\pom.xml


<plugins>
<plugin>
<!-- Apply the Checkstyle configurations defined in the top level pom.xml file -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.xpn.xwiki.platform</groupId>
<artifactId>xwiki-build-verifications</artifactId>
<version>${platform.tools.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>



Non-existing directories (???)




[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] basedir C:\Dev\XWiki\xwiki-platform-web\standard\target\skin does not exist
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.lang.IllegalStateException: basedir C:\Dev\XWiki\xwiki-platform-web\standard\target\skin does not exist
at org.codehaus.plexus.util.DirectoryScanner.scan(DirectoryScanner.java:550)
at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.getFilesToCopy(WarProjectPackagingTask.java:278)
at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.copyResources(WarProjectPackagingTask.java:229)
at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.handleWebResources(WarProjectPackagingTask.java:99)
at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.performPackaging(WarProjectPackagingTask.java:64)
at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:364)
at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:317)
at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:166)
at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:130)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
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)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 46 seconds
[INFO] Finished at: Sun Feb 03 21:18:53 CET 2008
[INFO] Final Memory: 38M/63M
[INFO] ------------------------------------------------------------------------


and:


[INFO] [assembly:single {execution: default}]
[INFO] Reading assembly descriptor: C:\Dev\XWiki\xwiki-product-enterprise\database\hsqldb\src\assemble\database.xml
[DEBUG] FileSet[/] dir perms: 40755 file perms: 100644
[DEBUG] The archive base directory is 'null'
[DEBUG] No dependency sets specified.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to create assembly: Error creating assembly archive: You must set at least one file.

[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to create assembly: Error creating assembly archive: You must set at least one file.
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
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: Failed to create assembly: Error creating assembly archive: You must set at least one file.

at org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:302)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
... 16 more
Caused by: org.apache.maven.plugin.assembly.archive.ArchiveCreationException: Error creating assembly archive: You must set at least one file.
at org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:107)
at org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:278)
... 18 more
Caused by: org.codehaus.plexus.archiver.ArchiverException: You must set at least one file.
at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.createArchiveMain(AbstractZipArchiver.java:260)
at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.execute(AbstractZipArchiver.java:242)
at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:513)
at org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:103)
... 19 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28 seconds
[INFO] Finished at: Mon Feb 04 20:35:58 CET 2008
[INFO] Final Memory: 31M/56M
[INFO] ------------------------------------------------------------------------



The "solution" was the most stupid (and simplest) thing I could think about namely creating these directories.

Something is definitely wrong, especially as far as HSQLDB is concerned because database is empty... I didn't have time to check it (and fix it).

I'm now happy that I built the whole project :)

Environment


I was building the project on Windows XP SP2 using Maven 2.0.8.

3 comments:

vmassol said...

Well you shouldn't have spent all this time since the build just works out of the box. We have a CI build to ensure that's always the case.

The documentation is here:
http://dev.xwiki.org/xwiki/bin/view/Community/Building

As you'll notice you MUST use the Maven version we provide. Maven has several bugs in other versions that make it not work in some edge cases.

Note that XWiki also builds again on Maven 2.1-SNAPSHOT trunk for the past few days thanks to John Casey fixing a bug there. However this is NOT yet recommended since we have not validated the XWiki build on that version yet.

Thanks
-Vincent

vmassol said...

Ah maybe something else that was affecting you. Right now the build isn't working on Windows.

See http://jira.xwiki.org/jira/browse/XWIKI-1696

None of the xwiki developers is using windows unfortunateley which is why this issue is dragging on...

We need to fix this. If you'd like to help please join us on the XWiki mailing list.

Thanks
-Vincent

Przemyslaw Bielicki said...

I missed the part of using Maven provided by you - I'll try it later on. Thanks for the hint.

Generally it works fine - only few changes were necessary which is really good regarding all other Maven issues (or rather Maven plugins).

I still don't have much time to work on it but maybe I will configure the whole dev environment soon.