Java と Bamboo を使い始める

This tutorial outlines how to use Bamboo to run, and get rapid feedback on, builds for your Java project. Bamboo has the concept of a 'plan' to look after the configuration for your continuous integration workflow. So, to run your first build, you'll create and run a Bamboo plan.

Information you need before you begin

This tutorial assumes you have an individual Bitbucket account. If you don't, it only takes minutes to create one, and you can always delete it after you're done. 

1. Create a project and plan

A Bamboo plan specifies the source code repository, the tasks to run in your build, and when to trigger a build. We start by creating a new plan:

  1. Log into your Bamboo instance as a user with permissions to create plans.
  2. Select Create > Create plan from the menu bar.

Every plan belongs to a project. We don't have a project yet, so select Project > New Project, and enter details for both the project and plan.

New project section in Bamboo

Bamboo needs to know the plan name, plan key and a brief description of what the plan is for. 

New plan details section in Bamboo

See Configuring plans for more details.

2. Connect to a source repository

Bamboo needs to know where the source code repository is located, and needs permissions to access the repo, so that it can check out the code when it runs a build. Enter your Bitbucket credentials, and select your repository.

Connect to the demonstration atlassian_tutorial/helloworld repo on Bitbucket for this tutorial, if you like.

Repository details section in Bamboo

See Linking to source code repositories for more details.

3. タスクの設定

Each plan needs to have at least one task specified. Tasks do the real work of the plan.

ソース コード チェックアウト タスク

新しく作成された計画には、先ほど指定したソース リポジトリからソース コードを取得する既定のソース コード チェックアウト タスクがあります。

See Checking out code for details.

ビルダー タスク

We also want to compile the code, and run the unit and integration tests. We'll add a builder task to the Bamboo plan to do that. We assume that your project already has a build process set up that Bamboo can call.

Select Add Task, then Builder and choose the task that matches the build tool for your project. Expand one of the following sections to see configuration details specific to that builder task:

Ant...

Ant configuration section in Bamboo

See http://ant.apache.org/manual/index.html for information about Ant.

Maven 3.0...

Maven configuration section in Bamboo

Bamboo also supports Maven 1.0 and Maven 2.0.  

See http://maven.apache.org/ for information about Maven.

注意:

  • A build tool needs to be installed on the Bamboo server machine before you can use the Bamboo task.
  • There are plugins available for Bamboo that add build tasks for other tools, such as Gant and Gradle. See the Atlassian Marketplace for details.

テスト結果を取得する

Your tests will be run when the builder task compiles the code. Each of the builder tasks above has a section to tell Bamboo to expect test results and where to look for them. You can specify a custom results location if your project directory doesn't use the conventional structure.

Test result files directory selection section in Bamboo

See Configuring jobs and Configuring tasks for details.

5. Run!

計画を有効にして、[作成] をクリックします。

You should see the plan run. Bamboo will:

  • Connect to the code repository
  • Check out the source code
  • Compile the code
  • Run unit and integration tests
  • Report back the test results

The 'Plan summary' tab will report whether the build succeeded or not.

ソース コード リポジトリの適切なディレクトリでのテストは、ビルドの一部として自動的に実行され、そのテスト結果は Bamboo に表示されます。

これで、リポジトリに変更をコミットするたびに、Bamboo がソース コードをビルドしてテスト結果をレポートします。

6. Get feedback

Bamboo のダッシュボードにビルド結果の要約が表示されます。

ビルドに関する詳細情報は、次の方法で入手できます。

  • 1 つ以上の計画のビルド結果をウォールボードで確認できます。
  • ビルド結果に関する通知をメール、インスタント メッセージ (IM)、RSS フィードで受信できます。
  • 計画に関するビルド統計や、ビルドにコードを提供している開発者に関するビルド統計を取得できます。
  • 結果を掘り下げて、ビルドをトリガーしたコードの変更内容と、そのビルドに対して実行されたテストを確認できます。

See Getting feedback for details.

最終更新日 2021 年 5 月 7 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.