IntelliJ IDEA plugin for formatting Gradle dependencies.
- Convert a string notation to a map notation
- Convert a map notation to a string notation
- Sort dependencies
- Paste a Maven dependency as a Gradle dependency (on the fly conversion)
Install using the JetBrains Plugin Repository:
File
> Settings
> Plugins
> Browse repositories...
> type gradle dependencies formatter
in search form > Install plugin
Use Show Intention Actions
action (Alt + Enter
or ⌥⏎) and choose Convert to map notation
or Convert to string notation
.
In order to sort dependencies open a .gradle
file and use Sort Gradle dependencies
action from Code
menu.
- Copy a declaration of a Maven dependency in any editor.
- Paste it into gradle file to dependencies section. Plugin will automatically convert it to a Gradle dependency.
Features:
- converts Maven dependency with
groupId
(required),artifactId
(required),version
,classifier
,optional
andexclusions
fields - handles scopes:
compile
,provided
,runtime
,test
- optional dependencies are coded using syntax defined by [Nebula Extra Configurations] (https://github.com/nebula-plugins/gradle-extra-configurations-plugin/)
- can convert several dependencies at once
If you need to paste XML with maven dependency into gradle file without modification, please use Paste Simple
action.
Note: This feature was added to IntelliJ IDEA in version 2016.3. It converts a single maven dependency at once and handles only simple cases.
Build:
./gradlew build
In order to run tests with specific IntelliJ IDEA version (e.g. 2016.3) use this command:
./gradlew -P ideaVersion=2016.3 test
Run IntelliJ IDEA with the plugin intalled in:
./gradlew runIde
This project uses gradle-intellij-plugin. Please refer to it's documentation for information about configuration.
Note: Currently the project is not prepared to be imported as a IntelliJ Platform Plugin.
- (bugfix) Unable to paste multiple Maven dependencies at once #3
- (bugfix) fixed NPE in
MapNotationToStringNotationIntention#getElementPredicate
- (improvement) Run
MavenToGradleDependenciesCopyPasteProcessor
before built-inCopyPasteProcessor
s
- (feature) Sort dependencies
- (feature) Convert a map notation to a string notation
- (bugfix) Convert string notation of a dependency with ext to a map notation
- Convert a string notation to a map notation
- Paste a Maven dependency as a Gradle dependency:
- added support for elements
classifier
andoptional
- version is skipped for dependency without version
- added support for elements
- Paste a Maven dependency as a Gradle dependency
This project is licensed under the MIT license.