-
Notifications
You must be signed in to change notification settings - Fork 14
Home
Since release 7.3.0 of the build plugins, it is now possible to use Micronaut dependencies from source during development. The dependencies will be automatically cloned from their GitHub repository and used in the build, whether it's a local build or a build on CI. This is basically a better replacement for snapshot dependencies: instead of having to publish a snapshot of a module in order to test changes, you can now simply point to the branch which contains the changes.
- Micronaut Build Plugins 7.3.0
- that the included build has
standardizedProjectNames
set totrue
(for Micronaut Core, this is only true since the4.8.x
branch)
In your settings.gradle(.kts
) file, in the micronautBuild
section, add requiresDevelopmentVersion
as needed, for example:
micronautBuild {
useStandardizedProjectNames = true
importMicronautCatalog()
importMicronautCatalog("micronaut-serde")
importMicronautCatalog("micronaut-sql")
importMicronautCatalog("micronaut-test-resources")
requiresDevelopmentVersion("micronaut-core", "4.8.x")
requiresDevelopmentVersion("micronaut-sql", "6.0.x")
}
This will trigger the substitution of dependencies from the versions declared in the gradle/libs.versions.toml
to their sources.
In this case, micronaut-core
will be fetched and will use branch 4.8.x
, while micronaut-sql
will use branch 6.0.x
.
Again, there's no need to publish the dependencies to maven local, or to a remote repository, to test changes!
By default, this feature will trigger the creation of a checkouts
directory where the included projects will be cloned.
However, it may be more practical, for local development, to use local clones.
In this case, the branch name declared in the settings.gradle(.kts)
file will simply be ignored.
In order to do this, add the auto.include.git.dirs
property to your ~/.gradle/gradle.properties
file, and point it to a directory where your Micronaut projects are cloned (it's the easiest if they are siblings in a single directory).
For example:
auto.include.git.dirs=/home/cchampeau/DEV/PROJECTS/GITHUB/micronaut
The directory names should match the repository names (in the example above, micronaut-core
and micronaut-sql
).
You may have to modify settings.gradle
and add:
dependencyResolutionManagement {
repositories {
mavenCentral()
mavenLocal {
mavenContent {
snapshotsOnly()
}
}
}
}
and in the base script of the module e.g. buildSrc/src/main/groovy/io.micronaut.build.internal.aws-base.gradle
repositories {
mavenCentral()
mavenLocal() {
mavenContent {
snapshotsOnly()
}
}
}