Merge "maven_jar: Add support to consume snapshot dependencies"
This commit is contained in:
@@ -430,6 +430,19 @@ And corresponding WORKSPACE excerpt:
|
|||||||
)
|
)
|
||||||
----
|
----
|
||||||
|
|
||||||
|
== Building against SNAPSHOT Maven JARs
|
||||||
|
|
||||||
|
To build against SNAPSHOT Maven JARs, the complete SNAPSHOT version must be used:
|
||||||
|
|
||||||
|
[source,python]
|
||||||
|
----
|
||||||
|
maven_jar(
|
||||||
|
name = "pac4j-core",
|
||||||
|
artifact = "org.pac4j:pac4j-core:3.5.0-SNAPSHOT-20190112.120241-16",
|
||||||
|
sha1 = "da2b1cb68a8f87bfd40813179abd368de9f3a746",
|
||||||
|
)
|
||||||
|
----
|
||||||
|
|
||||||
[[consume-jgit-from-development-tree]]
|
[[consume-jgit-from-development-tree]]
|
||||||
|
|
||||||
To consume the JGit dependency from the development tree, edit
|
To consume the JGit dependency from the development tree, edit
|
||||||
|
@@ -8,6 +8,10 @@ MAVEN_LOCAL = "MAVEN_LOCAL:"
|
|||||||
|
|
||||||
ECLIPSE = "ECLIPSE:"
|
ECLIPSE = "ECLIPSE:"
|
||||||
|
|
||||||
|
MAVEN_SNAPSHOT = "https://oss.sonatype.org/content/repositories/snapshots"
|
||||||
|
|
||||||
|
SNAPSHOT = "-SNAPSHOT-"
|
||||||
|
|
||||||
def _maven_release(ctx, parts):
|
def _maven_release(ctx, parts):
|
||||||
"""induce jar and url name from maven coordinates."""
|
"""induce jar and url name from maven coordinates."""
|
||||||
if len(parts) not in [3, 4]:
|
if len(parts) not in [3, 4]:
|
||||||
@@ -20,9 +24,25 @@ def _maven_release(ctx, parts):
|
|||||||
group, artifact, version = parts
|
group, artifact, version = parts
|
||||||
file_version = version
|
file_version = version
|
||||||
|
|
||||||
|
repository = ctx.attr.repository
|
||||||
|
|
||||||
|
if "-SNAPSHOT-" in version:
|
||||||
|
start = version.index(SNAPSHOT)
|
||||||
|
end = start + len(SNAPSHOT) - 1
|
||||||
|
|
||||||
|
# file version without snapshot constant, but with post snapshot suffix
|
||||||
|
file_version = version[:start] + version[end:]
|
||||||
|
|
||||||
|
# version without post snapshot suffix
|
||||||
|
version = version[:end]
|
||||||
|
|
||||||
|
# overwrite the repository with Maven snapshot repository
|
||||||
|
repository = MAVEN_SNAPSHOT
|
||||||
|
|
||||||
jar = artifact.lower() + "-" + file_version
|
jar = artifact.lower() + "-" + file_version
|
||||||
|
|
||||||
url = "/".join([
|
url = "/".join([
|
||||||
ctx.attr.repository,
|
repository,
|
||||||
group.replace(".", "/"),
|
group.replace(".", "/"),
|
||||||
artifact,
|
artifact,
|
||||||
version,
|
version,
|
||||||
|
Reference in New Issue
Block a user