Introduction to Codenvy
Introduction to Codenvy
Join the DZone community and get the full member experience.Join For Free
What is Codenvy exactly? Well, their website states:
Codenvy is a cloud environment for coding, building, and debugging apps.
Basically, it’s an IDE in the cloud (“IDE as a Service?”) accessible by all the major browsers. It started out as an additional feature to the eXo Platform in early 2009 and gained a lot of traction after the first PaaS (OpenShift) and Git integration was added mid-2011.
Codenvy targets me as a (Java) software developer to run and debug applications in their hosted cloud IDE, while being able to share and collaborate during development and finally publish to a repository – e.g. Git – or a number of deployment platforms – e.g. Amazon, OpenShift or Google App Engine.
I first encountered their booth at JavaOne last September, but they couldn’t demo their product right there on the spot over the wifi, because their on-line demo workspace never finished loading Well I got the t-shirt instead then, but now’s the time to see what Codenvy has in store as a cloud IDE.
Signing up took 3 seconds. All you have to do is go to codenvy.com, use the “Sign up” button, choose an email address and a name for your workspace, confirm the email they’ll send you and you’re done.The “workspace” holds all your projects and is part of the url Codenvy will create for you, like “ https://codenvy.com/ide/<workspace>.
Although not very clear during the registration process – which of course nowadays is usually minimalistic as can be – it seems that I’ve signed up for Codenvy’s Free Community Plan, which gives me an unlimited number of public projects. You can even start coding without registration.
After confirming the registration mail, I’m in. Finally I’ll end up in the browser where your (empty) workspace has been opened.
A few options a possible for here on, as seen in the figure above:
- Create a New Project from Scratch – Generate an empty project from predefined project types
- Import from GitHub – Import projects from your GitHub account
- Clone a Git Repository – Create a new project from any public Git reposiroty
- Browse Documentation
- Invite People – Get team members on board
- Support – Questions, feedback and troubleshooting
Create a New Project from Scratch
This option allows you to name the new project – e.g. “myproject”, choose a technology and a PaaS. The technology is a defined set of languages of frameworks to develop with.
At the moment the technologies are:
- Java JAR
- Java WAR
- Java Spring
- Ruby on Rails
- Maven Multi-module
At the time of writing Java 1.6 is supported.
At the moment the available platforms are:
- Amazon Webservices (AWS) Elastic Beanstalk
- Savvis Cloud AppFrog
- Google App Engine (GAE)
- Manymo Android Emulator
- Red Hat’s OpenShift
Depending on the choice of technology, or or more PaaS options become available. A single JAR can not be deployed onto any of the platforms, leaving only the option “None” available. A Java Web Application (WAR) can be deployed onto any number of platforms, except Heroku and Manymo. Node.js can only be deployed to OpenShift.
Creating a simple JAR project
After having selected a JAR (and no platform) one can select a project template.E.g. if webapplication (WAR) would have been selected, Codenvy would present project templates, such as Google App Engine Java project illustrating simple examples that use the Search API, Java Web project with Datasource usage or a demonstration of accessing Amazon S3 buckets using the Java SDK.
The JAR technology has only one project: Simple JAR project. After having finished the wizard, our JAR project has been created in our workspace. We’ll see two views of our project: a project explorer and a package explorer.
Project- and Package Explorer
What we can see is that our JAR project has been given a Maven pom.xml with the following content:
We have a generated group id
com.codenvy.workspaceyug8g52wjwb5im13, our own artifact id and the JUnit dependency, which is a decent choice for many Java developers use it as a testing framework. The source encoding has already been set to UTF-8, which is also a sensible choice.
As a convenience we’ve also been given a hello.SayHello class, so we know we’re actually in a Java project
File & Project Management
So what about the browser-based editor we’re working in? On top we’re seeing a few menu’s, like File, Project, Edit, View, Run, Git, PaaS, Window, Share and Help. I’ll be highlighting a few.
File- and Project menu
The File menu allows to creating folders, packages and various kind of filetypes, such as text, XML (1.0 at time of writing) , HTML (4.1) , CSS (2.0), Java classes and JSP’s (2.1). Although I’m in a JAR project, I am still also able to create here e.g. Ruby, PHP or Python files.
A very convenient feature is to upload existing files to the workspace, either separately or in ZIP archives. I’ve tried dropping a file onto the Package Explorer from the file system, but the browser (in this case, Chrome) tries to open it instead
The Project menu allows to create new projects, either by launching the Create Project wizard again, but also allows for importing from GitHub. In order to clone a repository, you’ll have to authorize Codenvy to access github.com to be able to import a project.
After having authorized GitHub, Codeenvy presents me with a list of projects to choose from. After having imported all necessary stuff, it somehow needs to know what kind of project I’m importing.
Selecting a file type after importing a project from GitHub
The project I imported didn’t give Codenvy any clues as to what kind of project it is (which is right since I only had a README.md in it), so it lists a few options to choose from. I chose the Maven multi-module type after which the output window shows:
firstname.lastname@example.org:tvinke/examples.git was successfully cloned. [INFO] Project type updated.
If you’d have a pom.xml in the root of your project, it would immediately recognize it a s a Maven project.
Apart from going through the Project > Import from GitHub option, you can also go directly to the Git menu, and choose Clone Repository. This allows you to manually enter the remote repository URI, wanted project name and the remote name (e.g. “origin”).
Cloning a repository
One you have pulled in a Git project, the Git menu allows all kinds of common operations, such as adding and removing files, committing, pushing, pulling and much more.
The SSH keys can be found under menu Window > Preferences where you can view the github.com entry, where one can view the details or delete it. Also a new key can be either generated or uploaded here.
Sharing the Project
One of the unique selling points of Codenvy are their collaboration possibilities which come along with any project. You can:
- Invite other developers with read-only rights or full read-write rights to your workspace and every project in it.When you’re pair-programming like this, or co-editing a file with a colleague, you can also send each other code pointers – small shortcuts to code lines.
- Use Factories to create temporary workspaces, through cloning, off one source project (“Factory”) and represent the cloning mechanism as a URL which can be given to other developers. A use case might be to get a colleague quickly started on a project by providing a fully working development environment.There’s a lot more about creating factories in the docs (such as through REST), but the nice thing is that once you have a Factory url, you can embed it as a button, send it through email of publish it somewhere for others!
A factory URL to load up e.g. their Twitter Bootstrap sample – as they use on their website themselves – looks like:
Applications are run in the cloud nowadays, so why not create them there too? Codenvy brings some interesting features, such as being able to instantly provision workspaces (through factory URLs) and share projects in real-time. It supports common operations with projects, files and version control. With a slew of languages and platforms and as an IDE being always accessible through the internet, it could lower the barrier to actually code anytime and anywhere. In a future post I will try and see whether or not it can actually replace my conventional desktop IDE for Java development.
Opinions expressed by DZone contributors are their own.