Support -PfromMavenLocal without any value
Close gh-21
This commit is contained in:
13
README.adoc
13
README.adoc
@@ -85,14 +85,23 @@ _Hint: You can use `--include-build` multiple times._
|
||||
==== Your project uses Maven or --include-build does not work
|
||||
|
||||
First, install the snapshots into your local Maven cache.
|
||||
You can now consume those snapshots using `-PfromMavenLocal` which takes a comma-separated list of group IDs:
|
||||
You can now consume those snapshots using `-PfromMavenLocal` which takes an
|
||||
optional comma-separated list of group IDs:
|
||||
|
||||
[source,]
|
||||
----
|
||||
./gradlew :framework:webmvc-tomcat:build -PfromMavenLocal=org.springframework
|
||||
----
|
||||
|
||||
The preceding example will run the `rest-template` smoke test, resolving Spring Framework from your local Maven cache.
|
||||
The preceding example will run the `webmvc-tomcat` smoke test, resolving Spring Framework from your local Maven cache.
|
||||
|
||||
You can also just specify:
|
||||
[source,]
|
||||
----
|
||||
./gradlew :framework:webmvc-tomcat:build -PfromMavenLocal
|
||||
----
|
||||
|
||||
Here all the dependencies will be resolved from your local Maven cache.
|
||||
|
||||
=== Override a dependency version
|
||||
|
||||
|
||||
@@ -79,10 +79,15 @@ public class CrSmokeTestPlugin implements Plugin<Project> {
|
||||
javaExtension.setTargetCompatibility(JavaVersion.VERSION_17);
|
||||
if (project.hasProperty("fromMavenLocal")) {
|
||||
String fromMavenLocal = project.property("fromMavenLocal").toString();
|
||||
Stream<String> includedGroups = Stream.of(fromMavenLocal.split(","));
|
||||
project.getRepositories()
|
||||
.mavenLocal(
|
||||
(mavenLocal) -> mavenLocal.content((content) -> includedGroups.forEach(content::includeGroup)));
|
||||
if (fromMavenLocal.isEmpty()) {
|
||||
project.getRepositories().mavenLocal();
|
||||
}
|
||||
else {
|
||||
Stream<String> includedGroups = Stream.of(fromMavenLocal.split(","));
|
||||
project.getRepositories()
|
||||
.mavenLocal(
|
||||
(mavenLocal) -> mavenLocal.content((content) -> includedGroups.forEach(content::includeGroup)));
|
||||
}
|
||||
}
|
||||
project.getRepositories().mavenCentral();
|
||||
project.getRepositories().maven((repo) -> {
|
||||
|
||||
Reference in New Issue
Block a user