This post is the result of trying to figure out how to setup a repository clone of one of my projects on my windows machine. I work on my Mac most of the time, but at times it’s more convenient to work on my Win machine (usually when I have to debug IE issues, and need to try js fixes to see what impact they make)
So, lets start by setting up our tools and IDE on Windows. We obviously need Java, Eclipse, and Maven, and actually that’s it. In Eclipse, install m2e and EGit plugins. Make sure you follow all the installation instructions for Maven with all the variables in the right place.
Now we need to setup SSH. This needs to happen in two places, in Eclipse settings and in Cloudbees settings. Here are the steps:
- In Eclipse, go to preferences->General->Network Connections->SSH2, select key management, and generate a DSA key. Enter the pass phrase and remember it, you’ll need it in a minute. Copy the public key to the clipboard.
- Click “Save private key” and save it, go to general and add the saved private key. Apply and save.
- Go into Cloudbees settings->SSH keys, choose a name and paste the public key from the clipboard. Click “Add”.
- Go to Cloudbees->Repositories, go into your project and copy to clipboard the SSH url unique to your repository.
- Go back to Eclipse, File->import, choose Git->Projects from Git. Choose URI and paste the SSH URL you copied from your repository. Choose ssh as the protocol. The user should be git, and password empty. Port can remain empty (it will be filled with the default which is 22)
- You will now need to enter your pass phrase.
- Next next next and your project will be cloned locally.
- To help maven work you need to go into Eclipse->Preferences->Maven, and go to installation->Add and pick the Maven installation you installed locally (instead of the Embedded one).
- If you run into problems with your project when you open the IDE, see this post. If you still have problems, and you had Maven installed before, try deleting the .m2 resources directory. You might also need to go into Preferences->Maven->User settings and reindex or update settings.
- Your project should automatically compile.
Problems you may encounter:
1. M2E installation fails and maven does not seem integrated into eclipse. I couldn’t fix that and had to reinstall eclipse
2. You get complaints about javac and JRE: you’re using JRE instead of JDK, switch to JDK in eclipse->java->installed jdk’s
Once you’ve purchased your domain, you need to tell cloudbees to allow access to your application from your domain. This can be done in the Applications->Manage->Configuration section, go to Domain Names and add your domain (without the http prefix, for example http://www.basicservice.com).
In Godaddy (or whichever provider you chose), you need to set the A record to point to your project’s IP (seems like everything in cloudbees is at 188.8.131.52, but you should ping your project and check).
Once those are done, wait for the DNS to propagate, and after an hour or so, you’re done!
The next post will discuss adding SSL to your service.