Pulling Source Code from Maven Repository

Version 1

    Summary

     

    From Jive 5 onward, we no longer provide a downloadable copy of the source code as a downloadable link through the website. Everything will be stored in our Maven repository from now on. It's a little more involved, but once you have Maven installed and created a new project, downloading the source JAR for your current version is fairly straightforward.

     

    Prerequisites

     

    Before doing this, you'll want to make sure that you have an Archiva account and that Maven is installed and configured correctly. You'll also want to create a new 5.0 project. Make sure to read and work through these documents prior to reading this document:

     

     

    Quite a few documents to run through, but the nice thing is that you'll only have to do this once.

     

    Details

     

    Java Source Code

     

    Once you've created your new 5.0 project, navigate to the root directory of the project (where the pom.xml sits) and enter:

     

    mvn dependency:sources
    

     

    This will resolve the project dependencies and place those sources into your local repository. If you haven't done this before, take a break or work on another task, as it'll take a while to download all the sources (roughly twenty minutes and just under 400 MB for me).

     

    The sources will sit in the repository directory within your M2_HOME (or wherever your settings.xml sits). If you're just interested in the Jive 5 source, you can find the source JAR at:

     

    M2_HOME/repository/com/jivesoftware/jive/
    

     

    If you have multiple builds of 5.0, you'll see multiple versions within the directory. For example, mine sits in 5.0.0.1/jive-5.0.0.1-sources.jar. You can either load the JAR into your IDE to pull the sources into the IDE, or you can explode the JAR manually and peruse the source code, i.e:

     

    jar xvf jive-5.0.0.1-sources.jar
    

     

    This will explode the source in whatever directory you're sitting in, so you'll want to move it wherever you want the sources to be stored.

     

    Theme

     

    Grabbing the default theme requires a different set of steps, since they don't sit in the JAR. On top of the prerequisite documents, you'll also want to run through the first two sections of Build and Run Your Local Jive Customization (up to "Build Your Project for the First Time"). Once you do that, you can navigate to (from the root directory of your project) web/overlays/com.jivesoftware.jive-5.0.0.1/WEB-INF/classes/template/ for the default theme -- where 5.0.0.1 is replaced with whatever version you're running on.

     

    Potential Problems

     

    When running mvn dependency:sources, you may see the following error:

     

    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1:15.396s
    [INFO] Finished at: Wed Aug 31 10:12:47 PDT 2011
    [INFO] Final Memory: 6M/81M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal on project web: Could not resolve dependencies for project com.jivesoftware.vinhsoft:web:war:1.0-SNAPSHOT: Failed to collect dependencies for [com.jivesoftware:jive:war:5.0.0.1 (compile), com.jivesoftware:jive:jar:5.0.0.1 (provided), com.jivesoftware:jive-lib:pom:5.0.0.1 (provided), javax.servlet:servlet-api:jar:2.4 (compile), ant-contrib:ant-contrib:jar:1.0b3 (compile), ant:ant-nodeps:jar:1.6.5 (compile), mysql:mysql-connector-java:jar:5.1.5 (provided), postgresql:postgresql:jar:8.3-603.jdbc3 (provided), org.openqa.selenium.client-drivers:selenium-java-client-driver:jar:0.9.2 (test), junit:junit:jar:4.8 (test), org.objenesis:objenesis:jar:1.2 (test), cglib:cglib:jar:2.2 (test), org.powermock:powermock-module-junit4:jar:1.4.9 (test), org.powermock:powermock-api-mockito:jar:1.4.9 (test), org.mockito:mockito-all:jar:1.8.5 (test)]: Failed to read artifact descriptor for com.jivesoftware:jive:war:5.0.0.1: Could not transfer artifact com.jivesoftware:jive:pom:5.0.0.1 from/to jive.internal (http://maven-secure.jivesoftware.com/archiva/repository/jive.internal): Access denied to: http://maven-secure.jivesoftware.com/archiva/repository/jive.internal/com/jivesoftware/jive/5.0.0.1/jive-5.0.0.1.pom -> [Help 1]
    [ERROR]
    

     

    This likely means that your Archiva account was locked. Please create a support ticket within your support group and Account Support will unlock the account.

     

    When building your project (in order to get the default theme), you may run out of memory:

     

    Downloaded: http://maven-secure.jivesoftware.com/archiva/repository/jive.internal/doxia/doxia-core/1.0-alpha-4/doxia-core-1.0-alpha-4.jar (255 KB at 1224.3 KB/sec)
    Downloaded: http://maven-secure.jivesoftware.com/archiva/repository/jive.internal/org/aspectj/aspectjtools/1.6.9/aspectjtools-1.6.9.jar (8661 KB at 1680.9 KB/sec)
    [ERROR] ABORT
    Aug 31, 2011 11:03:38 AM org.aspectj.weaver.tools.Jdk14Trace info
    INFO: Dumping to /Users/vinh.jones/work/source/customers/jive/vinhsoft50x/web/./ajcore.20110831.110337.439.txt
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1:41.649s
    [INFO] Finished at: Wed Aug 31 11:03:51 PDT 2011
    [INFO] Final Memory: 8M/123M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.3:compile (default) on project web: Compiler errors:
    [ERROR] abort ABORT -- (OutOfMemoryError) Java heap space
    [ERROR] Java heap space
    [ERROR] java.lang.OutOfMemoryError: Java heap space
    
    [ERROR] at org.aspectj.tools.ajc.Main.run(Main.java:363)
    

     

    If you're using Linux or OSX, you can set your MAVEN_OPTS at the command line and raise the heap (1 GB should be enough):

     

    export MAVEN_OPTS=-Xmx1024m
    

     

    If you're on Windows, you'll have to set your MAVEN_OPTS environment variable to a similar value.