[[!toc levels=3]]
This is a walk through of building a war file from the DVN source code. For information on deploying that war file to GlassFish, please see the [[deploy]] page.
Sign up at https://github.com
Please note that primary audience of this guide (for now) is people who have push access to https://github.com/IQSS/dvn . If you do not have push access and want to contribute (and we hope you do!) please fork the repo per https://help.github.com/articles/fork-a-repo and make adjustments below when cloning the repo.
You can use git with passwords over HTTPS but it's much nicer to set up SSH keys.
https://github.com/settings/ssh is the place to manage the ssh keys GitHub knows about for you. That page also links to a nice howto: https://help.github.com/articles/generating-ssh-keys
From the terminal, ssh-keygen
will create new ssh keys for you:
- private key:
~/.ssh/id_rsa
- It is very important to protect your private key. If someone else acquires it, they can access private repositories on GitHub and make commits as you! Ideally, you'll store your ssh keys on an encrypted volume and protect your private key with a password when prompted for one by
ssh-keygen
. See also "Why do passphrases matter" at https://help.github.com/articles/generating-ssh-keys
- It is very important to protect your private key. If someone else acquires it, they can access private repositories on GitHub and make commits as you! Ideally, you'll store your ssh keys on an encrypted volume and protect your private key with a password when prompted for one by
- public key:
~/.ssh/id_rsa.pub
After you've created your ssh keys, add the public key to your GitHub account.
Please see [[branches]] for detail, but in short, the "develop" branch is where new commits go. Below we will assume you want to make commits to "develop".
In NetBeans 7.1.1 or higher, click Team, then Git, then Clone.
- Repository URL:
github.com:IQSS/dvn.git
- Username:
git
- Private/Public Key
- Private Key File:
/Users/[YOUR_USERNAME]/.ssh/id_rsa
- Private Key File:
- Passphrase: (the passphrase you chose while running
ssh-keygen
)
Click Next.
Under Select Remote Branches check both of these:
develop*
master*
Click Next.
- Parent Directory:
/Users/[YOUR_USERNAME]/NetBeansProjects
- Clone Name:
dvn
- Checkout Branch:
develop*
Click Finish.
You should see a message that the clone has completed and you will probably be asked if you'd like to open a project. Click "Close" for now and don't open a project.
From the command line (show below) or otherwise, copy the project.properties
and project.xml
files into place for both the "DVN-web" and "DVN-ingest" projects:
murphy:~ pdurbin$ cd ~/NetBeansProjects/dvn/src/DVN-web/nbproject
murphy:nbproject pdurbin$ cp project.properties.DIST project.properties
murphy:nbproject pdurbin$ cp project.xml.DIST project.xml
murphy:nbproject pdurbin$ cd ~
murphy:~ pdurbin$ cd ~/NetBeansProjects/dvn/src/DVN-ingest/nbproject
murphy:nbproject pdurbin$ cp project.properties.DIST project.properties
murphy:nbproject pdurbin$ cp project.xml.DIST project.xml
murphy:nbproject pdurbin$
Click Open Project. In NetBeansProjects select dvn, the src, then DVN-web and Open Project.
Expect to see a dialog about reference problems. You can close this dialog for now.
You may also see a dialog about missing server if you have not added a GlassFish server in NetBeans yet.
Under Projects on the left you should now see DVN-web. Right-click it and click Open Required Projects. This should open DVN-ingest. These two projects are the only ones you need open for a build. If you open additional projects (DVN-EAR, DVN-EJB, and DVN-lockss) you will likely see build errors.
Download http://dvn.iq.harvard.edu/dev/icefaces/ICEfaces-2.0.2-Netbeans-7.0.zip and unzip it. Then click Tools, Plugins, Downloaded, Add Plugins, and select all three nbm files.
Afterwards you'll need to fix one of the plugins:
- Click Tools, then Ant Libraries
- Click "ICEfaces Components (2.0.2)"
- Click the red library (
nbinst://org.netbeans.libs.commons_logging/modules/ext/commons-logging-1.1.jar
) and click Remove - Click "Add JAR/folder" and add
~/NetBeansProjects/dvn/lib/dvn-lib-WEB/commons-logging.jar
(to replace the library you removed)
Create the following 5 custom libraries using Tools -> Ant Libraries -> New Library:
- dvn-lib-COMMON
- dvn-lib-EJB
- dvn-lib-WEB
- dvn-lib-NETWORKDATA
- dvn-lib-NETWORKDATA-EXTRA
For each of these, select all the jar files from the directories
- lib/dvn-lib-COMMON
- lib/dvn-lib-EJB
- lib/dvn-lib-WEB
- lib/dvn-lib-NetworkData
- lib/dvn-lib-NetworkData-EXTRA
respectively.
Under Projects, right-click DVN-web and choose "Resolve Reference Problems". You should see the following jars listed:
- auto-depends.jar
- common-util.jar
- config-api.jar
- grizzly-config.jar
- internal-api.jar
Highlight one of these jars and click Resolve. Then browse for the jar in the glassfish/glassfish/modules directory of your GlassFish installation. This should resolve the problem for all five jars above, but if it doesn't, the rest of the jars can be found in the same location.
Depending on how you installed NetBeans, you migtht already have JUnit installed.
In the same "Resolve Reference Problems dialog" if you see problems with junit or junit_4, click Resolve and follow the prompts to install JUnit from the NetBeans plugin portal.
Note: If you installed a version of NetBeans that includes GlassFish, this step may not be necessary.
Under Projects, right-click DVN-web, select "Resolve Missing Server Problem" and browse to the place where you have downloaded and installed GlassFish to add the server.
At this point, under Projects, the DVN-web icon should no longer indicate any errors and you can try a build. Hit F11 or click Run, then Build Project.
If you get "BUILD SUCCESSFUL", you can proceed to the [[deploy]] step.