Developing Applications with Eclipse and Oracle Developer Cloud Service


Options



Before You Begin

Purpose

This tutorial covers how to take an application from Eclipse and move it to Oracle Developer Cloud Service. The tutorial also takes you through creating issues, creating a code review, and building an application. To make this process more focused, the tutorial uses a starter application that you need to download and install. The download link is in the What Do You Need? section.

Time to Complete

Approximately 1 hour

Background

Oracle Enterprise Pack for Eclipse (OEPE) is a set of plug-ins designed for the Eclipse IDE to support development of Java EE applications. Oracle Developer Cloud Service provides a number of tools that help you manage the application development lifecycle. Those tools include source control management, issue tracking, Hudson continuous integration, Wiki collaboration, code review tools, Agile development, and deployment integration. This tutorial covers many but not all of these tools.

Scenario

In this tutorial, you use OEPE and Oracle Developer Cloud Service to create and build an application. The application is really just a shell that includes one Java web service and a single JSP page. So that you can perform all the activities yourself, you'll assign both an issue and a code review to yourself, instead of to other members of your team, as you would normally do.

What Do You Need?

  • An Oracle Cloud account that includes Oracle Developer Cloud Service. You would need Oracle Java Cloud Service in order to deploy your application. When you order Oracle Java Cloud Service, you also get Oracle Developer Cloud Service. You can sign up for a free trial of Oracle Java Cloud Service at Oracle Java Cloud Service. (Oracle Messaging Cloud Service, Oracle Mobile Cloud Service, and Oracle SOA Cloud Service also include Oracle Developer Cloud Service.)

  • One of the following:

    This tutorial refers to either kind of installation as OEPE.

  • An installation of Java Development Kit (JDK) 8

  • The starter application zip file (to download it, right-click the link and select your browser's option for saving the file)

  • One of the following supported browsers:

    • Chrome 48 or later (also for Android)
    • Firefox 38 or later
    • Internet Explorer 11 or 12
    • Safari 7 or 8 (Mac OS)
    • Safari Mobile 5 (iOS)

Setting Up OEPE and Oracle Developer Cloud Service

When you work in OEPE, you organize your work in projects that together make an application. For Oracle Developer Cloud Service integration, we'll start with an application, then push it to the Oracle Developer Cloud Service Git repository.

Importing the Starter Application

In this first section, you import the starter application into OEPE.

  1. Navigate to where you installed OEPE and double-click eclipse.exe to open Eclipse and OEPE. In the Eclipse Launcher dialog, select a workspace of your choice and click OK. (If you are using Eclipse Mars, this page looks a bit different.)

    Choosing an Eclipse workspace
    Description of this image
  2. In Eclipse, click Workbench. (If you are using Eclipse Mars, this page looks a bit different.)

    Opening the Workbench
    Description of this image

    The Workbench opens.

    Eclipse Workbench
    Description of this image
  3. Since we are developing a Java EE application and using Oracle Developer Cloud Service, we want to use the Java EE perspective. From the menu, select Window, then select Perspective, then select Open Perspective, and then select Java EE.

    Opening Java EE Perspective
    Description of this image

    Outline and Task List tabs appear in the upper right corner. An Oracle Cloud view appears in the lower left corner. You will use this view in the next section.

  4. From the Eclipse menu, select File, and then select Import. If you have not yet downloaded the starter application, go back to the What Do You Need? section to find the download link.

    File > Import menu selection
    Description of this image
  5. In the Import dialog box, expand General, select Existing Projects into Workspace, and click Next.

    Import dialog box
    Description of this image
  6. In the Import dialog box, select the Select archive file option, then use the Browse button to find and select the zip file for the project (oepeodevcstutorialstarter.zip). Click Finish to import the project.

    Import Projects dialog box
    Description of this image
  7. In the Project Explorer, expand the HelloApp project to see the artifacts within the project.

    Project in Project Explorer
    Description of this image

Now that you have imported the starter application into OEPE, you will create a connection to Oracle Developer Cloud Service and push the project to the cloud.

Creating the Cloud Project

In Oracle Developer Cloud Service, projects are used to contain artifacts and facilities that represent an application. In this section, you create a project on Oracle Developer Cloud Service to hold your application.

  1. In the Oracle Cloud view, click Connect to open the connection creation wizard.

    Oracle Cloud Connect link
    Description of this image
  2. Enter the connection details for your Oracle Cloud account. Enter MyCloudConnection in the Connection name field. Click Finish

    Oracle Cloud Connection dialog
    Description of this image
  3. In the Oracle Cloud view, expand the Oracle Developer Cloud Service identity domain node under MyCloudConnection. You may or may not have access to existing projects. For this tutorial, you will create your own project.

    Cloud connection node
    Description of this image

    In your environment, you may see other Oracle Cloud services.

    Cloud connection node with more services
    Description of this image

    In the next few steps you will use a browser to create a Cloud project.

  4. Open a browser of your choice and navigate to your Oracle Cloud instance. On the first screen, enter your identity domain and click Go.

    Identity domain screen
    Description of this image
  5. On the second screen, enter your user name and password, and then click Sign In.

    User name and password screen
    Description of this image
  6. When you sign in, you see the Welcome page, which lists all the projects that you own or to which you have been granted access. If you have never logged in before, you will see a welcome banner with a message that looks something like this.

    Welcome page message
    Description of this image

    Click New Project.

    Welcome page project list
    Description of this image
  7. On the Project Details page of the Create Project wizard, enter a Name and Description for your project. Specify OEPE ODevCS Tutorial for the project name, and select the Private option in the Security area. Click Next.

    First page of Create Project wizard
    Description of this image
  8. On the Template page of the wizard, select Initial Repository and click Next. Your environment may include additional templates.

    Second page of Create Project wizard
    Description of this image
  9. On the Project Properties page, select Textile from the Wiki Markup drop-down list. Select the Initialize repository with README file option. Finally, click Finish.

    Last page of Create Project wizard
    Description of this image

    After you click Finish, Oracle Developer Cloud Service begins the process of provisioning your project. This may take a minute or two. You will see a page similar to the following while the project is being provisioned.

    Provisioning page
    Description of this image

    When the project provisioning is complete, you are on the Project page of your project, which contains a set of tabs. You can click the Show/Hide Labels icon at the bottom to hide the labels. You can click the Menu icon to hide or show the tabs.

    Tabs on project Home page
    Description of this image

    On the left side of the page is an activity feed.

    Activity feed
    Description of this image

    On the right side of the page is a news feed, along with the Repositories tab and two other tabs. The middle tab is Graphs and Statistics, and the last tab is Team.

    Repositories tab
    Description of this image
  10. Return to OEPE. In the Oracle Cloud view, right-click your identity domain and select Refresh.

    Refresh menu selection
    Description of this image

    Your new OEPE ODevCS Tutorial project is displayed in the view.

    New project in Oracle Cloud view
    Description of this image

When the Oracle Cloud view connects to your account, it may see multiple projects (as in this example). However, to gain access to the project, you have to activate the project. This holds true for all of the parts of the project, as you will see later.

Loading an Application Into Oracle Developer Cloud Service

OEPE provides a rich set of interfaces to Oracle Developer Cloud Service. To use those tools, you first establish a connection with your account on Oracle Developer Cloud Service.

  1. In the Oracle Cloud view, either double-click the OEPE ODevCS Tutorial project, or right-click the project and select Activate.

    Activate menu selection
    Description of this image
  2. Once the project is activated, expand the Code node to see the Git repository.

    Git repository
    Description of this image
  3. One of the features of OEPE is the ability to move a project into an Oracle Developer Cloud Service Git repository using Drag and Drop.

    Close the HelloApp node, then drag HelloApp from the Project Explorer to the Git repo in the Oracle Cloud view.

    Drag project to repository
    Description of this image
  4. In the Synchronize dialog box, enter a message in the Git commit message text area, or accept the default, Initial commit of project HelloApp and dependencies. Make sure the Generate or update Maven artifacts for build in Developer Cloud check box is NOT selected and that the Create Hudson build job check box IS selected. Then click Finish.

    Synchronize dialog box
    Description of this image

    You don't need to generate the Maven build files because the project is already a Maven project and the build files (pom.xml) already exist in the project.

    The Synchronize wizard does a number of things behind the scenes:

    • It clones the Oracle Developer Cloud Service Git repository, pushes the Eclipse project files to the local repository, and synchronizes with the Oracle Developer Cloud Service Git master branch.

    • If the Generate or update Maven artifacts for build in Developer Cloud check box is selected, it generates a Maven pom.xml file for the project(s) and pushes Java Build Path library dependencies into the Oracle Developer Cloud Service project Maven repository. In our example, the pom.xml file is already included in the project download files, so there is no need to regenerate it.

    • It creates a new Hudson build job for each project that is being pushed, correctly references the Maven pom.xml file, and saves the build artifacts.

  5. Click OK in the Success dialog box.

    Success dialog box
    Description of this image

    Your project is now synchronized with Oracle Cloud.

  6. Navigate back to the browser and click the Project tab to refresh the page. The synchronization activities are listed, including the initial commit and the build. It will probably take a while for the build to start and complete; you can click the Build tab to watch it happening.

    Project build
    Description of this image

    On the Project page, the activity feed looks like this. You may need to refresh the browser.

    Synchronization activities
    Description of this image
  7. Click the Code tab to view the repository actions.

    Code tab
    Description of this image
  8. Click the Commits button on the right side of the page.

    Commits button
    Description of this image

    The Commits view shows each commit made, with the date and time along with the commit description.

    Commits view
    Description of this image
  9. Under the latest commit, click the Show Details link on the right side of the page.

    Show Details link
    Description of this image

    The Details view provides a partial list of the files that were changed in the commit. You can click the Commit Details link to view all the files.

    Details view of commit
    Description of this image

So far, you have created a connection from OEPE to your Oracle Developer Cloud Service instance and uploaded an existing OEPE project into the Cloud. In the next section, you will begin to explore Oracle Developer Cloud Service from the Web UI. In the next part of this tutorial, you will add some code to the application.

Making Changes to an Application

Now you will create an Oracle Developer Cloud Service task to track progress, create a merge request for code review and approval, make code changes on the branch, build the application, merge the branch to the master, and close the issue.

Creating a Task

    One of the features of Oracle Developer Cloud Service is the ability to initiate, assign, and track issues or tasks related to your project. In this section, you will create a task in the Oracle Developer Cloud Service web UI.

  1. In the browser, click the Issues tab for the project, then click the New Issue button.

    New Issue button
    Description of this image
  2. On the New Issue page, enter details similar to the ones below. In the Summary field, enter Edit index page. In the Description text area, enter Provide a correct path for the servlet. Select Task from the Type drop-down list, and select New from the Status drop-down list.

    Left side of New Issue page
    Description of this image
  3. From the Owner drop-down list, select your own name. Finally, click Create Issue.

    Create Issue button
    Description of this image

    A Task 1 page opens for the issue. You can edit this task or post comments at any time.

  4. Return to the Oracle Cloud view of OEPE and double-click Issues to activate the issues, then right-click the Mine or Open node and select Activate to activate it.

    Activate menu selection for issues
    Description of this image

    When you expand the Mine node, the task you just created in the Oracle Developer Cloud Service web UI appears in the view. A Synchronizing dialog box may appear briefly.

    Issue in Issues node
    Description of this image
  5. Double-click the Edit index page issue to open it in OEPE.

    Issue in OEPE
    Description of this image

Now that you have a coding task created and assigned to you, you can create a merge request for reviewing the code, then make the required code changes.

Creating a Merge Request

Now that you have added code, pushed it to Oracle Developer Cloud Service, and built the application, the next step is to create a merge request. When you create a merge request, you can create a branch on which to make changes to the code and build your modified application to make sure the change does not break anything. The merge request also allows other team members to review and comment on the code, and then to approve or reject the code. Once the code is reviewed, you merge the code from the branch to the master. You can perform a merge whether or not the code has been approved.

You're probably running this tutorial by yourself, so you will be the only reviewer.

  1. In the browser, click the Merge Requests tab, and then click New Merge Request.

    New Request button
    Description of this image
  2. On the Branch page of the New Merge Request wizard, select the Git repository from the Repository drop-down list. Select master from the Target Branch drop-down list. In the Review Branch field, enter IndexBranch to create a branch for this review, then click Next.

    New Merge Request wizard
    Description of this image
  3. On the Details page, type T in the Linked Issues field and select Task 1 when it appears. Leave the Linked Builds field blank. Enter Review change to index page in the Summary field. Select yourself as the reviewer, then click Next.

    New Merge Request wizard
    Description of this image
  4. On the Description page, enter Review change to index.jsp file (Task 1) in the Edit Description text area. Finally, click Create. (If you specify the task name in the Description field, a link to the task will be displayed on the review page.)

    New Merge Request wizard
    Description of this image

    Team members that you add to this code review receive email messages stating that they've been asked to collaborate in a code review on the project. They can approve or reject the code changes and provide descriptive text to support their decision.

    The code review page opens. Notice that the task you mentioned in the Description field appears as a link.

    Left side of review page
    Description of this image

    On the right side of the page, buttons allow the submitter or reviewers to merge the code, approve or reject the changes, or close the review without merging.

    Right side of review page
    Description of this image
  5. Click the Linked Issues tab to view the task that is associated with the merge request.

    Contents of Linked Issues tab
    Description of this image
  6. Click the Code tab. From the branch drop-down menu, select IndexBranch. Verify that the branch code is the same as the master.

    Branch code in Code tab
    Description of this image

Synchronizing the Review Branch

In OEPE, you need to fetch the new branch you created for the review and create a local branch that corresponds to it.

  1. In the Project Explorer, right-click HelloApp and select Team, then select Fetch from Upstream to fetch the branch you created for the review.

    Fetch branch code
    Description of this image
  2. In the Fetch Results dialog, click OK.

    Fetch Results
    Description of this image

    In the Oracle Cloud view, expand the Code and Branches nodes.The branch appears in the Remote Tracking node as origin/IndexBranch, but it has no local version.

    Fetch Results
    Description of this image
  3. To create a local branch to match the one you created for the merge request, right-click the repository and select Switch To, then New Branch.

    Source code editor
    Description of this image
  4. In the Create Branch dialog box, give the branch the same name as the remote one (IndexBranch). Select the Configure upstream for push and pull check box. Leave the Checkout new branch check box selected, and click Finish.

    Source code editor
    Description of this image

    In the Oracle Cloud view, the branch is now selected. The branch name also appears in the Project Explorer window.

    Source code editor
    Description of this image

Changing Code and Pushing to Oracle Developer Cloud Service

    In this section, you make the code changes that have been assigned to you. After you have completed the code, you will update the task.

    In these first few steps, you switch to the branch you created, then add code to index.jsp.

  1. In the Project Explorer, expand HelloApp, then expand src/main/webapp and double-click index.jsp to open the file in the code editor.

    Source code editor
    Description of this image
  2. The servlet URL in the href attribute is /GreetingServlet, but this is not correct for the deployed application. Change it to /HelloApp/GreetingServlet.

    The code should look something like the following:

    Modified code
    Description of this image
  3. Select File, then select Save to save your work. Ignore the warning icon that appears in the code.

    Save menu selection
    Description of this image

    Now that you have modified the code as requested in the task, you can commit your changes to the local Git repository and then push your changes to the remote repository.

  4. In the Project Explorer, right-click HelloApp and select Synchronize with Oracle Cloud.

    Synchronize with Oracle Cloud menu selection
    Description of this image
  5. In the Git commit message text area of the Synchronize dialog box, enter a message, such as Edited servlet URL, and then click Finish.

    Commit dialog box
    Description of this image
  6. Right-click HelloApp and select Team, then select Push Branch ‘IndexBranch’.

    Push Branch menu selection
    Description of this image
  7. In the Push to Branch in remote page of the wizard, click Next.

    Push to Branch in remote page
    Description of this image
  8. In the Push Confirmation page, click Finish.

    Push Confirmation page
    Description of this image
  9. In the Push Results page, click OK.

    Push Results page
    Description of this image

    Notice that in the Oracle Cloud view, the local and remote versions of IndexBranch both have the same version.

    IndexBranch in Oracle Cloud view
    Description of this image
  10. Return to the browser and click the Project tab. The activity feed displays the latest commit, the change to the index file.

    Activity feed
    Description of this image
  11. Click the Code tab and navigate to the HelloApp/src/main/webapp/index.jsp page. Verify that the commit comment and the code change appear in the branch.

    Code view
    Description of this image
  12. Click Commits to see your commit.

    Commit tab
    Description of this image
  13. On the right side of the page, opposite the latest commit, click Show Details. The file you changed appears, and you can click the file name to get another view of the changed code.

    Details view
    Description of this image

Building the Application

In this section, you will take the completed code and run a build on it to verify that it works.

  1. In the browser, click the Build tab. Notice the status of the HelloApp-build job, which was created when you first uploaded the project from OEPE.

    We want to examine the configuration of the build job, so click the HelloApp-build link.

    Build page
    Description of this image

    The HelloApp-build page is displayed.

    Left side of contacts-build page
    Description of this image
  2. On the right side of the HelloApp-build page, click Configure to see the job configuration.

    Configure button
    Description of this image
  3. On the Configure build job page, click the Source Control tab.

    Main tab of Configure build job page
    Description of this image
  4. From the Branch Specifier drop-down list, select IndexBranch.

    Branch Specifier under Source Control tab
    Description of this image
  5. Click Save in the top right corner.

    Save button
    Description of this image
  6. Click Build Now to launch another build.

    Build Now button
    Description of this image

    When you click Build Now, your job will be in line for the next available executor. The status of the build job will change. First it is queued.

    New build queued message
    Description of this image

    Then it is running.

    New Build progress bar
    Description of this image

    Finally, it is completed and successful.

    Completed build in table
    Description of this image

At this point, you would normally deploy the application to your Oracle Java Cloud Service instance to verify that it runs correctly. To do this, you would follow the instructions in the OBE tutorial Deploying an Application from Oracle Developer Cloud Service to Oracle Java Cloud Service. This tutorial does not include deploying the application.

Updating the Issue

  1. You can update issues or tasks from either the browser or the OEPE interface. In OEPE, close the Code node and expand the Issues node in the Oracle Cloud view, then double-click the issue to open it if it is not already open.

    Issues node
    Description of this image
  2. On the Task page, enter a comment in the New Comment text area, such as Edited index.jsp to add /HelloApp to the URL. Then click Submit.

    Status drop-down list
    Description of this image
  3. Return to the browser and click the Issues tab, then click the issue link.

    New Comment text area
    Description of this image
  4. On the Task 1 page, scroll down to the Activity area to see the comment you added.

    Add and Save buttons
    Description of this image

Performing a Review and Merge

Now that you have added code, pushed it to Oracle Developer Cloud Service, built the application, and updated the issue, the next step is to complete the review and merge the code.

  1. In the browser, click the Merge Requests tab, then click the Summary link.

    Merge Requests page
    Description of this image
  2. On the review page, click the Changed Files tab to verify that the change is correct.

    Contents of Changed Files tab
    Description of this image
  3. On the right side of the page, click Approve to approve the code.

    Approve button
    Description of this image
  4. Provide an appropriate description of the approval, such as Looks correct to me, and then click OK.

    Approve dialog box
    Description of this image
  5. Click the Conversation tab to view the approval comment.

    Approval in Conversation tab
    Description of this image
  6. The approval is displayed in the Reviewers list, and the Approve button is now grayed out for you, because you have approved the code.

    You can now merge the code into the master. To do this, click the Merge button.

    Grayed-out Approve button
    Description of this image
  7. In the Merge dialog box, enter a message in the Commit Message text area, such as Merging index.jsp change from IndexBranch to master. Select the default check boxes, Squash Commits and Close Linked Issues. Then click the Merge button.

    Merge dialog box
    Description of this image

    The review page reports the status as MERGED, and the merge message appears below.

    MERGED status on review page
    Description of this image

    The only button on the right is the Delete Branch button.

    Delete Branch button
    Description of this image
  8. Click the back button (<) or the Merge Requests tab to return to the Merge Requests page.

    Back button
    Description of this image

    The MERGED status is displayed in the Status column.

    MERGED Status of merge request
    Description of this image
  9. Click the Issues tab and notice that the issue Status is now Resolved. Click the Summary link.

    Issues page
    Description of this image
  10. Scroll down to the Activity area and view the comment that the system added when you merged the code and resolved the issue.

    Issues page
    Description of this image
  11. Click the Code tab and use the branch drop-down list to switch from the branch to the master.

    Switching to master
    Description of this image

    The code displays your merge comment.

    Activities related to code review
    Description of this image
  12. Return to OEPE. On the Task page, click the link next to the warning icon to update the task based on your changes. The full message is Task has incoming changes.

    Updating task
    Description of this image

    The task is now marked RESOLVED and FIXED.

    Resolved task
    Description of this image

    In the Oracle Cloud view, the issue is crossed out to indicate that it is resolved.

    Oracle Cloud view of resolved task
    Description of this image
  13. Scroll down to the Comments area. The merge-related activities are reported here, too.

    Oracle Cloud view of resolved task
    Description of this image

Pulling Your Changes to the Local Branch

  1. In the Oracle Cloud view of OEPE, close the Issues node and expand the Code node so that you can see the branches. Your commits to the local and remote branch appear, but not your commits to the master. You'll need to pull the changes to the master down to your local branch in OEPE.

  2. Local commits
    Description of this image
  3. In the Project Explorer, right-click HelloApp and select Team, then select Switch To, and then select master.

    Switch to master menu selection
    Description of this image
  4. In the Oracle Cloud view, right-click the repository and select Pull.

    Pull menu selection
    Description of this image
  5. In the Pull Result dialog box, click OK.

    Pull Result dialog box
    Description of this image

    The Oracle Cloud view now shows the latest commit to the master.

    Updated commits from pull
    Description of this image
  6. In the Project Explorer, expand the project, then expand src/main/webapp and double-click index.jsp to verify that the changes now appear in the master.

    Code changes in master
    Description of this image

Closing the Issue and Deleting the Branch

  1. In OEPE, click the Edit index page tab, scroll down to the bottom of the issue, and select the Mark as Closed option, then click Submit.

    Submit button
    Description of this image
  2. In the web browser, click the Issues tab. The issue status is now Closed.

    Closed issue
    Description of this image
  3. You can now delete the branch you created. In the browser, click the Merge Requests tab, then click the link to the merge request in the Summary column.

    Merge Request link
    Description of this image
  4. Click the Delete Branch button.The message "Branch 'IndexBranch' successfully merged and deleted" is displayed at the top of the page. Click the X to close the message.

    Delete Branch button
    Description of this image
  5. Click the Code tab and verify that only the master branch appears in the drop-down list.

    Branches drop-down list
    Description of this image
  6. Click the Project tab and view the activities you have performed.

    Project page activities
    Description of this image
  7. If you wish, exit OEPE and sign out of Oracle Developer Cloud Service.

Want to Learn More?