You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Gradle plugin is used, it is not possible to set multi-value property for a publication.
Setting it using snippet below doesn't work. Value gets set as single string.
project.tasks.artifactoryPublish.configure {
properties.put("q.os", "win32, deb, osx")
// or
properties.put("q.os.2", "win32;deb;osx")
}
Usage of ; separator makes Artifactory web UI show correctly number of values for q.os.2 but value will be still considered as a single property value and it will not be possible to use REST API to search for something like q.os.2=deb.
When a new property is added from UI, using ; Artifactory will process the value as expected.
I prepared following build.gradle.kts to demo the issue which you see below.
Project name in my case is jfrog-tags-issue. This is a root project also, hence all the configuration is in one place.
None of the properties options will result in a multi-value property being set correctly.
group ="artifactory.issue"
plugins {
java
id("com.jfrog.artifactory") version "4.24.21"
id("maven-publish")
}
val issueDemoPublication = publishing.publications.register("issueDemo", MavenPublication::class.java) {
from(components.getByName("java"))
}
project.tasks.artifactoryPublish.configure {
publications(issueDemoPublication.name)
properties.put("tag-properties", "val1")
properties.put("tag-properties", "val2")
properties.put("tag-properties", "val3")
mapOf(
"tag-properties-comma" to "val1,val2,val3",
"tag-properties-semicolon" to "val1;val2;val3",
"q.os" to "win32, deb, osx"
).forEach {
properties.put(it.key, it.value)
}
}
artifactory {
setContextUrl("http://localhost:8081/artifactory")
publish {
repository {
setRepoKey("maven-on-artifactory")
setUsername("anonymous")
}
}
}
Run the publication
./gradlew artifactoryPublish -Pversion=0.3
For the demo I've added two more properties with , and ; using Artifactory web UI. You will recognise them by the name in the json output below.
If the expected multi-value property separator is ; then tag-properties-semicolon should have same value as tag-ui-semicolon in JSON output above.
Searching for a property with query like tag-properties-semicolon=val2 should find the artifact by one of the multiple property's values, like it's possible for tag-ui-semicolon.
The documentation should suggest the correct separator.
E.g. Set Item Properties mention it's possible to set os=win,linux with , separator. But why then , doesn't work from Artifactory UI? Also in Gradle plugin when , separator is used, Artifactory UI doesn't handle it if it was multi-value.
Artifactory Version: Open source license 7.27.9 rev 72709900 (running inside Docker image, used for the demo above); EnterpriseX license 7.21.12 rev 72112900 (on which the issue was originally noticed)
Additional context
Here's the PUT request that was printed during the demo artifact upload from Artifactory Gradle plugin with a build running with --debug property:
Executing request PUT /artifactory/maven-on-artifactory/artifactory/issue/jfrog-tags-issue/0.3/jfrog-tags-issue-0.3.jar;build.timestamp=1635953438316;build.name=jfrog-tags-issue;tag-properties-semicolon=val1%3Bval2%3Bval3;q.os=win32%2C+deb%2C+osx;tag-properties=val1%2C+val2%2C+val3;build.number=1635953438347;tag-properties-comma=val1%2Cval2%2Cval3 HTTP/1.1
The text was updated successfully, but these errors were encountered:
When Gradle plugin is used, it is not possible to set multi-value property for a publication.
Setting it using snippet below doesn't work. Value gets set as single string.
Usage of
;
separator makes Artifactory web UI show correctly number of values forq.os.2
but value will be still considered as a single property value and it will not be possible to use REST API to search for something likeq.os.2=deb
.When a new property is added from UI, using
;
Artifactory will process the value as expected.The
q.os
property example I got from the plugin documentation page: https://www.jfrog.com/confluence/display/JFROG/Gradle+Artifactory+PluginTo Reproduce
I prepared following
build.gradle.kts
to demo the issue which you see below.Project name in my case is
jfrog-tags-issue
. This is a root project also, hence all the configuration is in one place.None of the properties options will result in a multi-value property being set correctly.
Run the publication
For the demo I've added two more properties with
,
and;
using Artifactory web UI. You will recognise them by the name in the json output below.Then we query REST API to get the properties
curl "http://localhost:8081/artifactory/api/storage/maven-on-artifactory/artifactory/issue/jfrog-tags-issue/0.3/jfrog-tags-issue-0.3.jar?properties"
which returns following:
Notice the
tag-ui-semicolon
has several strings in the values, while others have one.Running search for the property which was set from Gradle plugin doesn't provide any results:
But the one set from UI could be found:
Expected behavior
;
thentag-properties-semicolon
should have same value astag-ui-semicolon
in JSON output above.tag-properties-semicolon=val2
should find the artifact by one of the multiple property's values, like it's possible fortag-ui-semicolon
.E.g. Set Item Properties mention it's possible to set
os=win,linux
with,
separator. But why then,
doesn't work from Artifactory UI? Also in Gradle plugin when,
separator is used, Artifactory UI doesn't handle it if it was multi-value.Screenshots
Versions
Additional context
Here's the
PUT
request that was printed during the demo artifact upload from Artifactory Gradle plugin with a build running with--debug
property:The text was updated successfully, but these errors were encountered: