This document will walk you through creating a new project with Maven. You'll only need to go through this process once per project, at its inception.
This document assumes that you have done this: How-To: Install Maven and properly set up: settings.xml - For Licensed Customers and Partners. It assumes you have secured access to the Jive Maven repository, and have a local SVN repository for your own customizations.
If you are reading this document to get some information about joining an existing maven project, start with Step 4 after checking out the existing 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:create -e -DarchetypeGroupId=com.jivesoftware.maven -DarchetypeArtifactId=maven-clearspace-x-archetype -DgroupId=com.jivesoftware.dummycustomer -DartifactId=dummyCustomerSite -DarchetypeVersion=2.5.3 -DremoteRepositories=http://maven-secure.jivesoftware.com/archiva/repository/jive.internal
Substitutions
groupId | The namespaced group where this project should live. e.g. com.jivesoftware.intel |
artifactId | The name of this project, e.g., openPort |
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.
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:create -e -DarchetypeGroupId=com.jivesoftware.maven -DarchetypeArtifactId=maven-clearspace-plugin-archetype -DgroupId=com.jivesoftware.module1 -DartifactId=module1 -DarchetypeVersion=2.5.3 -DremoteRepositories=http://maven-secure.jivesoftware.com/archiva/repository/jive.internal
Substitutions
groupId | the namespaced group where this project should live. e.g. com.jivesoftware.intel |
artifactId | the name of this plugin e.g., virus-scan |
| archetypeVersion | the base Clearspace version |
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 as well.
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 "setup" https://svn.yourserver.com/svn/<customer-project>
svn import -m "importing original project" . https://svn.yourserver.com/svn/<customer-project>/trunk
svn mkdir -m "setup" https://svn.yourserver.com/svn/<customer-project>/branches
svn mkdir -m "setup" https://svn.yourserver.com/svn/<customer-project>/tags
Substitutions
<customer-project> | The name of your customer project |
When the editor appears, add a comment and then write and quit
Delete the base directory you've created - after running the import you need to wack 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, e.g.
svn co https://svn.jivesoftware.com/svn/ext/customer/<customer-project>/trunk/ .
Storing your IDE project files in SVN is a bad idea, and will lead to confusion. Tell Subversion to ignore IDEA files and target directories from the base directory:
svn propedit svn:ignore .
Your editor will appear. Add the patterns you want to get rid of, like:
target
projectFilesBackup
dummyCustomerSite.iml
dummyCustomerSite.iws
dummyCustomerSite.ipr
.DS_STORE
Do a svn commit to get your svn:ignore properties to change. e.g. svn commit . -m "Ignore the junk"
Now do the same from your ./web directory and any of your plugin directories, to avoid putting junk into SVN.
Your default development database should be PostgreSQL. If you have it installed, it should be straightforward for you to manually create a new database from the command line or pgAdmin.
The database name must be the format <artifactId>-<customer.version>. For example, dummyCustomerSite-1.0-SNAPSHOT. Encoding UTF8 is recommended.
The very first time you build your project, use the following command from the top-level project directory: mvn -Djive.setup=false install This will force you into the Clearspace setup screens the next time that you start the app server. Note: It's OK to run mvn clean install your project root. You'll never be forced into the setup screens again, unless you build from the top with mvn -Djive.setup=false install.
For subsequent builds, it may only be necessary for you to build at the web or plugin levels by using mvn clean package within the module's directory. If you want to build multiple plugins and web at once, run mvn install from the top-level directory.
See the steps here Maven: How to use with IDEA