Amper のアップデート – 2024 年 2 月号
Amper は JetBrains が提供する実験的なプロジェクト構成ツールです。 0.2.0 リリースとその付属ツールに関する機能更新とハイライトをお知らせします。
Amper が Gradle バージョンカタログや新しい依存関係の追加の補完などをサポートするようになりました!詳しい内容について以下をお読みください。
Gradle バージョンカタログ
Gradle バージョンカタログを使用する既存プロジェクトに Amper をより簡単に追加できるよう、Amper が このようなカタログに宣言されている依存関係に $libs.library.name 構文を使用してアクセスできるようにしました。
IDE はカタログで宣言されているライブラリの補完を提供します。
Amper マニフェストから参照先のカタログエントリに移動し、Amper モジュール内のカタログエントリの使用箇所を検索することも可能です。
インテンションアクションを使用して新しい依存関係をカタログに簡単に追加できます。また、カタログエントリとしても使用可能な依存関係を直接使用している場合には警告が表示されます。
Amper マニフェストとバージョンカタログファイルは宣言的な性質であるため、カタログファイルを編集する際にはプロジェクトをインポートし直さなくても補完とインスペクションによってリアルタイムに更新されます。
依存関係の補完サポート
依存関係とそのバージョンを見つけやすくするため、Amper マニフェストを編集する際にパッケージ検索 が提供する依存関係の補完機能を使用できるようにしました。
この補完機能は作業中の依存関係ブロックを認識し、互換性のある依存関係のみを提案します。
この例では、すべてのプラットフォーム用の Coil を検索した場合は KMP 対応の 3.x リリースのみが提案されていますが、Android 用の Coil を検索した場合は Android 限定の 2.x リリースも表示されています。
IntelliJ IDEA での Amper プロジェクトの作成
IntelliJ IDEA 2024.1(現在 EAP で提供中)より、New Project(新規プロジェクト)ウィザードを使用する際に Amper ベースの新しい Kotlin プロジェクトを作成できるようになりました。

IDEの機能
Amper は Fleet、IntelliJ IDEA、および Android Studio でサポートされています。 これらの IDE は Amper モジュールマニフェストを操作するための専用のツールを提供しています。
マニフェストファイルのガターアイコンから任意の Amper アプリケーションを簡単に実行できます。
通常の補完だけでなく、スキーマのネスト補完を使用して設定が必要な特定の構成値を簡単に見つけることができます。
クイックドキュメントショートカットを使用すると、さまざまな構成エントリの正しい構文と使用可能なオプションを見つけることができます。
Amper の使用を開始する
使用を開始するには、チュートリアルとサンプルプロジェクトをご覧ください。 共有 UI と ネイティブ UI を使用した KMP テンプレートアプリを確認することもできます。
Fleet ユーザーはここに掲載されている機能をバージョン 1.30 以降で使用できます。 JetBrains Toolbox App を使用して最新バージョンをダウンロードしてください。
IntelliJ IDEA でこれらの Amper 機能を使用するには、2024.1 EAP バージョン以降を使用し、最新バージョンの Amper プラグインがインストールされていることをご確認ください。
最新バージョンにアップデート
プロジェクトですでに Amper を使用している場合は、最新バージョンにアップデートしてください。
plugins {
id("org.jetbrains.amper.settings.plugin").version("0.2.0")
}
この新しいバージョンでも、いくつかのリポジトリを追加する必要があります。
pluginManagement {
repositories {
…
// Amper repositories
maven("https://maven.pkg.jetbrains.space/public/p/amper/amper")
maven("https://www.jetbrains.com/intellij-repository/releases")
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
}
}
ご意見をお寄せください
Amper は現在も実験的であり、活発な開発作業が行われています。 このような早期の段階では本番環境で使用することはお勧めできませんが、Amper をお試しのうえ、ツールについてのご感想をお寄せいただけると幸いです。 皆さんのフィードバックは Amper の未来を形成するのに役立ちます!
使用した感想をフィードバックするには、Kotlinlang Slack の #amper チャンネルでディスカッションにご参加いただくか、YouTrack の課題で提案やアイデアをご提供ください。
オリジナル(英語)ブログ投稿記事の作者:
Discover more
Amper 更新 – 2024 年 2 月
Amper 是 JetBrains 的实验性项目配置工具。 随着 0.2.0 版本及其配套工具的发布,我们有多项精彩功能更新和亮点分享。
Amper 现已支持 Gradle 版本目录、针对添加新依赖项的补全等!继续阅读了解详情。
Gradle 版本目录
为了使 Amper 更易添加到使用 Gradle 版本目录的现有项目中,Amper 现在可以使用 $libs.library.name 语法访问这些目录中声明的依赖项。
IDE 为目录中声明的库提供了补全:
您还可以从 Amper 清单导航到引用的目录条目,并查找 Amper 模块中目录条目的用法:
意图操作可供向目录轻松添加新依赖项,如果直接使用依赖项(当它也可作为目录条目使用时),检查会发出警告:
得益于 Amper 清单和版本目录文件的声明性,补全和检查会在您编辑目录文件时实时更新,不需要您重新导入项目。
针对依赖项的补全支持
为了使依赖项及其版本更易查找,您现在编辑 Amper 清单时将获得依赖项的补全,此功能由 Package Search(软件包搜索)提供支持:
此补全功能知道您正在处理哪个依赖项块,并且只会建议兼容的依赖项:
在此示例中,搜索适用于所有平台的 Coil 仅提供支持 KMP 的 3.x 版本,而搜索适用于 Android 的 Coil 则会显示仅适用于 Android 的 2.x 版本。
在 IntelliJ IDEA 中创建 Amper 项目
从 IntelliJ IDEA 2024.1(目前在 EAP 中提供)开始,您可以在使用 New Project(新建项目)向导时创建基于 Amper 的新 Kotlin 项目:

IDE功能
Fleet、IntelliJ IDEA 和 Android Studio 支持 Amper。 这些 IDE 提供了用于处理 Amper 模块清单的专用工具。
您可以从清单文件中的装订区域图标轻松运行任何 Amper 应用程序:
除了常规补全之外,架构的嵌套补全还可让您轻松找到您可能想要设置的特定配置值:
快速文档快捷键可以帮助您发现正确的语法和各种配置条目的可用选项:
开始使用 Amper
首先,请查看教程和示例项目。 您还可以查看具有共享 UI 和原生 UI 的 KMP 模板应用。
如果您使用的是 Fleet,则此处显示的功能可在 1.30 及更高版本中提供。 您可以使用 JetBrains Toolbox App 下载最新版本。
要在 IntelliJ IDEA 中访问这些 Amper 功能,请使用 2024.1 EAP 或更高版本,并确保您已安装最新版本的 Amper 插件。
更新到最新版本
如果您已经在项目中使用 Amper,请将其更新到最新版本:
plugins {
id("org.jetbrains.amper.settings.plugin").version("0.2.0")
}
这个新版本还需要添加一些额外仓库:
pluginManagement {
repositories {
…
// Amper repositories
maven("https://maven.pkg.jetbrains.space/public/p/amper/amper")
maven("https://www.jetbrains.com/intellij-repository/releases")
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
}
}
分享您的反馈
Amper 仍处于实验阶段,正在积极开发中。 虽然您目前还不应当在生产中使用它,但我们希望您试用 Amper 并与我们分享您对该工具的想法。 您的反馈将帮助塑造 Amper 的未来!
要提供体验反馈,请加入 Kotlinlang Slack 上的 #amper 频道,或在 YouTrack 上的问题中分享建议和想法。
本博文英文原作者:
Discover more
Amper Update – February 2024
Amper is an experimental project configuration tool by JetBrains. With the 0.2.0 release and its accompanying tooling, we have some exciting feature updates and highlights to share.
Amper now supports Gradle version catalogs, completion for adding new dependencies, and more! Read on for more details.
Gradle version catalogs
To make it easier to add Amper to an existing project that uses Gradle version catalogs, Amper can now access dependencies declared in these catalogs, using the $libs.library.name syntax.
The IDE offers completion for libraries declared in a catalog:
You can also navigate from an Amper manifest to referenced catalog entries and find the usages of catalog entries in Amper modules:
Intention actions make it easy to add a new dependency to a catalog, and inspections will warn you if you are using a dependency directly when it’s also available as a catalog entry:
Thanks to the declarative nature of both Amper manifests and the version catalog file, completion and inspections update in real time as you edit the catalog file, without requiring you to re-import the project.
Completion support for dependencies
To make it easier to find dependencies and their versions, you will now get completion for dependencies when editing an Amper manifest, powered by Package Search:
This completion feature is aware of which dependencies block you’re working in, and will only suggest compatible dependencies:
In this example, searching for Coil for all platforms offers only the KMP-ready 3.x releases, while searching for Coil for Android also shows the 2.x releases that are Android-only.
Creating Amper projects in IntelliJ IDEA
Starting from IntelliJ IDEA 2024.1 (currently available in EAP), you can create a new Kotlin project based on Amper when using the New Project wizard:

IDE features
Amper is supported in Fleet, IntelliJ IDEA, and Android Studio. These IDEs offer dedicated tooling for working with Amper module manifests.
You can easily run any Amper application from gutter icons in the manifest file:
On top of regular completion, nested completion of the schema makes it easy to find specific configuration values that you might want to set:
The quick documentation shortcut can help you discover the correct syntax and the available options for various configuration entries:
Get started with Amper
To get started, take a look at the tutorial and the sample projects. You can also check out the KMP template apps with shared UI and native UI.
If you’re using Fleet, the features shown here are available in version 1.30 and later. You can download the latest version using the JetBrains Toolbox App.
To get access to these Amper features in IntelliJ IDEA, use the 2024.1 EAP version or later and make sure you have the latest version of the Amper plugin installed.
Update to the latest version
If you’re already using Amper in a project, update it to the latest version:
plugins {
id("org.jetbrains.amper.settings.plugin").version("0.2.0")
}
This new version also requires some additional repositories to be added:
pluginManagement {
repositories {
…
// Amper repositories
maven("https://maven.pkg.jetbrains.space/public/p/amper/amper")
maven("https://www.jetbrains.com/intellij-repository/releases")
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
}
}
Share your feedback
Amper is still experimental and under active development. While you should not use it in production at this early stage, we encourage you to try Amper and share your thoughts about the tool with us. Your feedback will help shape the future of Amper!
To provide feedback about your experience, join the discussion in the #amper channel on the Kotlinlang Slack, or share your suggestions and ideas in an issue on YouTrack.