Skip to content

Commit 8166ca9

Browse files
committed
GitHub Issue 1015: Update CheckForVersionConflicts to account for using some jars that differ by classifier only but should not coexist.
1 parent 4b22bef commit 8166ca9

2 files changed

Lines changed: 42 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ on how to do that, including how to develop and test locally and the versioning
1818
- [GitHub Issue 464](https://github.com/LabKey/internal-issues/issues/464) Update `Distribution.substituteModuleDependencies` (moved from `BuildUtils`) to incorporate variant usage so it will pick up the module file
1919
- Update to Gradle 9.4.1
2020
- Update various dependency versions
21+
- [Github Issue 1015](https://github.com/LabKey/internal-issues/issues/1015) Update `CheckForVersionConflicts` to account for using some jars that differ by classifier only but should not coexist.
2122

2223
### 7.3.1
2324
*Released* 11 February 2026

src/main/groovy/org/labkey/gradle/task/CheckForVersionConflicts.groovy

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,40 @@ class CheckForVersionConflicts extends DefaultTask
3434
@Input
3535
Set<String> MULTIPLE_VERSIONS_ALLOWED = Set.of("jackson-core", "jackson-databind")
3636

37+
// GH Issue 1015: We are using milestone versions of spring-ai jars, which use classifiers like -M2 to distinguish the differnet versions.
38+
// We want to have the later milestones replace the earlier ones, so we want to exclude the milestone classifier from the name when
39+
// comparing for conflicts. This is rather sketchy and I hope it goes away soon. The list has to include all transitive dependencies as
40+
// we as the direct dependencies, and since the artifacts are not released for production use they are not entirely stable, so it's entirely
41+
// possible that, say, a jar with milestone M2 will not have the same name with M3 or M4 and won't get cleaned up during the conflict checking.
42+
@Input
43+
Set<String> USE_CLASSIFIER_IN_VERSION = Set.of(
44+
"spring-ai-bom",
45+
"spring-ai-starter-model-google-genai",
46+
"spring-ai-anthropic",
47+
"spring-ai-openai",
48+
"spring-ai-client-chat",
49+
"spring-ai-advisors-vector-store",
50+
"spring-ai-starter-model-google-genai-embedding",
51+
"spring-ai-autoconfigure-model-chat-client",
52+
"spring-ai-autoconfigure-mcp-sever-common",
53+
"spring-ai-autoconfigure-mcp-server-webmvc",
54+
"spring-ai-autoconfigure-model-chat-memory",
55+
"spring-ai-autoconfigure-model-chat-observation",
56+
"spring-ai-autoconfigure-model-google-genai",
57+
"spring-ai-autoconfigure-model-tool",
58+
"spring-ai-autoconfigure-retry",
59+
"spring-ai-commons",
60+
"spring-ai-google-genai",
61+
"spring-ai-google-genai-embedding",
62+
"spring-ai-mcp",
63+
"spring-ai-mcp-annotations",
64+
"spring-ai-model",
65+
"spring-ai-retry",
66+
"spring-ai-starter-mcp-server-webmvc",
67+
"spring-ai-template-st",
68+
"spring-ai-vector-store"
69+
)
70+
3771
enum ConflictAction {
3872
delete,
3973
fail,
@@ -87,8 +121,9 @@ class CheckForVersionConflicts extends DefaultTask
87121
if (matcher.matches())
88122
{
89123
// we support artifacts with different classifiers (e.g., activeio-core-3.1.0-tests.jar should not be in conflict with activeio-core-3.1.0.jar)
90-
String nameWithClassifier = matcher.group(BuildUtils.ARTIFACT_NAME_INDEX)
91-
if (matcher.group(BuildUtils.ARTIFACT_CLASSIFIER_INDEX) != null)
124+
String nameWithoutClassifier = matcher.group(BuildUtils.ARTIFACT_NAME_INDEX)
125+
String nameWithClassifier = nameWithoutClassifier
126+
if (matcher.group(BuildUtils.ARTIFACT_CLASSIFIER_INDEX) != null && !USE_CLASSIFIER_IN_VERSION.contains(nameWithoutClassifier))
92127
nameWithClassifier += matcher.group(BuildUtils.ARTIFACT_CLASSIFIER_INDEX)
93128
if (nameVersionMap.containsKey(nameWithClassifier))
94129
{
@@ -98,7 +133,7 @@ class CheckForVersionConflicts extends DefaultTask
98133
}
99134
else
100135
{
101-
haveMultiples = true
136+
haveMultiples = !USE_CLASSIFIER_IN_VERSION.contains(nameWithoutClassifier)
102137
conflictMessages += "Multiple existing ${matcher.group(BuildUtils.ARTIFACT_NAME_INDEX)} ${extension} files."
103138
}
104139
}
@@ -114,14 +149,15 @@ class CheckForVersionConflicts extends DefaultTask
114149
}
115150
}
116151
}
152+
// nameVersionMap has "spring-ai", "2.2.0-M2" in it
117153
collection.files.each { File f ->
118154
Matcher matcher = BuildUtils.VERSIONED_ARTIFACT_NAME_PATTERN.matcher(f.name)
119155
if (matcher.matches())
120156
{
121157
String name = matcher.group(BuildUtils.ARTIFACT_NAME_INDEX)
122-
if (matcher.group(BuildUtils.ARTIFACT_CLASSIFIER_INDEX) != null)
158+
if (matcher.group(BuildUtils.ARTIFACT_CLASSIFIER_INDEX) != null && !USE_CLASSIFIER_IN_VERSION.contains(name))
123159
name += matcher.group(BuildUtils.ARTIFACT_CLASSIFIER_INDEX)
124-
if (nameVersionMap.containsKey(name))
160+
if (nameVersionMap.containsKey(name)) // with match for spring-ai
125161
{
126162
String version = matcher.group(BuildUtils.ARTIFACT_VERSION_INDEX)
127163
if (version != null)

0 commit comments

Comments
 (0)