Maven: How To Create a New Maven Project

Version 40

    THIS DOCUMENT IS OBSOLETE!!

    Please use How To: Create a Custom Jive Project instead.


















    Note: This document assumes that you have Maven installed and configured with access to Jive's Maven repositories. Once these steps are completed, check out Build and Run Your Local Jive Customization.

     

    Step 1: Create a new base project

     

    New project templates in Maven are called archetypes.

     

    You will want to run the archetype in the top level directory where you store your projects. (For example, if you store your code in ~/code you'll cd into that directory.)

     

    Run this command (with the 3 substitutions listed below):

     

    mvn archetype:generate -e -B -DarchetypeGroupId=com.jivesoftware.maven -DarchetypeArtifactId=maven-jive-archetype -DarchetypeVersion=7.0.x-SNAPSHOT -DgroupId=com.jivesoftware.dummycustomer -DartifactId=dummyCustomerSite
    
    
    
    
    
    
    
    

     

    Substitutions

     

    ArgumentDescription7.0.x6.0.x5.0.x4.5.x
    archetypeArtifactIdThe name of the archetype being appliedmaven-jive-archetypemaven-jive-archetypemaven-jive-archetypemaven-sbs-archetype
    archetypeVersionThe archetype version for the major version of Jive being used.  Do NOT modify the value to reflect the point release of Jive you are using.  The values listed to the right should be included exactly as they appear.7.0.x-SNAPSHOT6.0.x-SNAPSHOT5.0.x-SNAPSHOT4.5.x-SNAPSHOT
    groupIDThe namespaced group where this project should liveex: com.jivesoftware.mycompanyex: com.jivesoftware.mycompanyex: com.jivesoftware.mycompanyex: com.jivesoftware.mycompany
    artifactIDThe name of this projectex: myProjectex: myProjectex: myProjectex: myProject
    jiveVersion (optional)The version of Jive to build this version against. If not provided, the value will default to the most current version. (See Jive EAE/Search Dependency Map)ex: 7.0.0.0ex: 6.0.1.2n/an/a
    eaeVersion (optional)The version of the Enterprise Activity Engine to run locally. If not provided, the value will default to the most current version. (See Jive EAE/Search Dependency Map)ex: 1.3.2.3n/an/a
    searchVersion (optional)The version of the Search Server to run locally. If not provided, the value will default to the most current version. (See Jive EAE/Search Dependency Map)ex: 2.15.32.7-synonyms.6n/an/a

     

     

     

    If you've configured your settings.xml file correctly, Maven will download all that it needs and complete without error.  You will have a nice new folder called "dummyCustomerSite" in your current directory.

     

    If the creation of the project failed check your Maven configuration for problems, wipe the newly-created directory clean, and try again.

     

    To change the project to go against a particular version of Jive, edit the pom.xml file in the root project directory, and change the appropriate XML node depending on which major version of Jive you're developing against.

     

      • Jive v4.5.x — <sbs.version> example: <sbs.version>4.5.5.0</sbs.version>
      • Jive v5.x — <jive.version> example: <jive.version>5.0.0.0</jive.version>
      • Jive v6.x – <jive.version> example: <jive.version>6.0.0.0_RC8</jive.version>
      • Jive v7.x – <jive.version> example: <jive.version>7.0.0.0</jive.version>

            The archetype defaults SBS dependency to Employee version. It should not matter as the Public or Employee determination is based of the license used, except that on JCA (Green Cloud) the version information it displays is driven off by this dependency. So you can either ignore the version information on JCA or correct the dependency to avoid the confusion (jive-sbs-public for public site -or- jive-sbs-employee for internal site)

     

     

    Step 2: Add plugins

     

    Any time you want to add a new plugin, you will run the following command from within your new project directory.  In the above example that would be from within "dummyCustomerSite".

     

    mvn archetype:generate -e -B -DarchetypeGroupId=com.jivesoftware.maven -DarchetypeArtifactId=maven-jive-plugin-archetype -DarchetypeVersion=7.0.x-SNAPSHOT -DgroupId=com.jivesoftware.module1 -DartifactId=module1
    
    
    
    
    
    
    
    

     

    Substitutions

     

     

    ArgumentDescription7.0.x6.0.x5.0.x4.5.x
    archetypeArtifactIdThe name of the archetype being appliedmaven-jive-plugin-archetypemaven-jive-plugin-archetypemaven-jive-plugin-archetypemaven-sbs-plugin-archetype
    archetypeVersionThe archetype version for the major version of Jive being used.  Do NOT modify the value to reflect the point release of Jive you are using.  The values listed to the right should be included exactly as they appear.7.0.x-SNAPSHOT6.0.x-SNAPSHOT5.0.x-SNAPSHOT4.5.x-SNAPSHOT
    groupIDThe namespaced group where this plugin project should liveex: com.jivesoftware.mycompanyex: com.jivesoftware.mycompanyex: com.jivesoftware.mycompanyex: com.jivesoftware.mycompany
    artifactIDThe name of this pluginex: myPluginex: myPluginex: myPluginex: myPlugin

     

     

    To specify a particular version of jive to compile the plugin against (and it should be the same version as the parent project), modify the appropriate element in the plugin's pom.xml file according to the table above.

     

    Maven will register the plugin with the root pom.xml so if you run package or compile from the root directory, the child plugin will be packaged/compiled, as well.

     

    Note: If you run into an error state when installing a plugin that states that you have an incorrect conversion of a ManagerImpl to a Manager, even though the ManagerImpl implements the Manager. You are likely developing on a Windows machine, and if you have camel case in your root plugin class file (ie. FeedbackWidget) it may not work correctly. It should work on a *nix system, but to workaround on Windows, try to edit your plugin.xml 'name' attribute to be a lowercase value.

     

     

    Step 3: Add to SVN

     

      • First you want to make sure your project is clean, so run mvn clean from the project root (top level).
      • Next, import your project to SVN:

     

    
    export SVN_EDITOR=vi (for Mac/*nix) OR set SVN_EDITOR=edit (for Windows)
    svn mkdir -m <JIRA-issue> https://svn.jivesoftware.com/svn/ext/customer/<customer-project>
    svn import -m <JIRA-issue> https://svn.jivesoftware.com/svn/ext/customer/<customer-project>/trunk
    svn mkdir -m <JIRA-issue> https://svn.jivesoftware.com/svn/ext/customer/<customer-project>/branches
    svn mkdir -m <JIRA-issue> https://svn.jivesoftware.com/svn/ext/customer/<customer-project>/tags
    
    
    
    
    
    
    
    

     

    Substitutions

     

     

    VariableValue
    <customer-project>The name of the customer project.  Should reflet the name of the customer and the project to protect from the possibliity of name collisions in the future.
    <JIRA-issue>The issue number for the placeholder JIRA issue created to cover creation of the project

     

     

     

      • Delete the base directory you've created.
        (After running the import you need to get rid of the originals because they are not versioned. If you ran an update it would complain ". is not a working copy")
      • Checkout your newly imported project from Subversion into a blank base customer directory

     

    
    svn co https://svn.jivesoftware.com/svn/ext/customer/<customer-project>/trunk .
    
    
    
    
    
    
    
    

     

     

    svn propedit svn:ignore .
    
    
    
    
    
    
    
    

     

    Your editor will appear.  Add the patterns you want get rid of, like:

     

    target
    .classpath
    .settings
    .project
    .DS_STORE
    dummyCustomerSite.iml
    dummyCustomerSite.iws
    dummyCustomerSite.ipr
    
    
    
    
    
    
    
    

     

    • Do a svn commit to get your svn:ignore properties to change. (example: svn commit . -m "Ignore the junk")

     

    svn -m <JIRA-issue> commit .
    
    
    
    
    
    
    
    

     

     

    • Now do the same from your ./web directory and any of your plugin directories, to avoid putting junk into SVN.