Allow to specify Maven profiles via the CLI app

This commit is contained in:
Alexandre Archambault 2016-07-03 16:33:01 +02:00
parent f4dc1044e3
commit efb4f6c5c0
No known key found for this signature in database
GPG Key ID: 14640A6839C263A9
3 changed files with 15 additions and 1 deletions

View File

@ -273,11 +273,13 @@ class Helper(
}
}
val userEnabledProfiles = profile.toSet
val startRes = Resolution(
dependencies.toSet,
forceVersions = forceVersions,
filter = Some(dep => keepOptional || !dep.optional)
filter = Some(dep => keepOptional || !dep.optional),
profileActivation = Some(core.Resolution.userProfileActivation(userEnabledProfiles))
)
val loggerFallbackMode =

View File

@ -74,6 +74,10 @@ case class CommonOptions(
@Help("Print dependencies as an inversed tree (dependees as children)")
@Short("T")
reverseTree: Boolean,
@Help("Enable profile")
@Value("profile")
@Short("F")
profile: List[String],
@Recurse
cacheOptions: CacheOptions
) {

View File

@ -453,6 +453,14 @@ object Resolution {
}
}
def userProfileActivation(userProfiles: Set[String])(
id: String,
activation: Activation,
props: Map[String, String]
): Boolean =
userProfiles(id) ||
defaultProfileActivation(id, activation, props)
/**
* Default dependency filter used during resolution.
*