Apache » Cocoon »

  Apache Cocoon
   homepage

Apache Cocoon

How to solve Maven 2 problems

If you have problems to build Cocoon with Maven 2, please follow these instructions. If they don't solve your problem, report your problems to http://issues.apache.org/jira/browse/COCOON. An error report should contain your Maven version (mvn --version), the revision number of you working copy of Cocoon and the complete error report (e.g. mvn install -X -e).

Cleanup your local repository

It helps to zap your local repo every now and then. There is no way as of yet to force maven to redownload poms it has already (MNG-1258). Poms are being updated without version number increment even though they shouldn't. If the problem might exist with Cocoon artifacts only, removing [local-maven-repository]/org/apache/cocooon should be enough.

Maven repository usually is located in the folder:

[Win]  C:\Documents and Settings\<Your Login Name>\.m2\repository
[Unix] ~/.m2/repository

or different locations can be configured in ~/.m2/settings.xml.

Remove a configured Mirror

If you're using a mirror (see the section below where to look for the configuration) try removing it. The Maven central repository at http://repo1.maven.org is the most reliable one and should be fast enough in the meantime.

Configure a mirror

Maven relys on public repositories. From time to time they are not accessible mostly because of heavy load. To solve this problem, use one of the mirrors in ~/.m2/settings.xml:

<settings>
  <mirrors>
    <mirror>
      <mirrorOf>central</mirrorOf>
      <id>ibiblioEuropeanMirror</id>
      <url>http://mirrors.dotsrc.org/maven2</url>
    </mirror>
    <!-- 
    <mirror>
      <mirrorOf>central</mirrorOf>
      <id>ibiblioAustralianMirror</id>
      <url>http://public.planetmirror.com/pub/maven2</url>
    </mirror>    
     -->
  </mirrors>
</settings>

For more information check the page on configuring mirrors.

Common Maven errors

java.lang.OutOfMemoryError: Java heap space

It occurs when you try whole Cocoon sources, especially serializers block. The problem lays in code of this block that demands more than 64mb of memory in order to compile. Solution is simple - give Maven more memory by setting environment variable:

[Win] set MAVEN_OPTS=-Xmx256m
[Unix] MAVEN_OPTS='-Xmx256m'

And then fire your mvn command as before. It should work now.

And when your build works

Run Maven in offline mode

You shouldn't  get any problems anymore as long as you don't update your local repo. To switch on the offline mode, append the -o parameter. e.g.

mvn clean -o

Setup a company internal proxy repository

If you don't want to rely on external repositories, you can setup a company internal proxy repository. The Codehaus wiki contains more information about the setup process