os-maven-plugin
os-maven-plugin copied to clipboard
Prefix os.detected.classifier property on mac
This is a small feature request.
Currently the plugin does not work out of the box with the bytedeco/javacpp-presets
on mac.
For example, the opencv bindings are published for different architectures
http://search.maven.org/#search%7Cga%7C1%7Corg.bytedeco.javacpp-presets%20opencv
MacOs is refered to as macosx-x86_64
, whereas currently the plugin resolves mac to osx.
Is there some way to overwrite the detection, such that no additional handling of this case is needed and one can simply write
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>opencv</artifactId>
<classifier>${os.detected.classifier}</classifier>
</dependency>
Sounds like a good idea. Will try to find some time.
@trustin I am currently running into a similar issue. Is there any known workaround for this issue?
Be careful here. Other projects have used the value of 'osx' instead of 'macosx' when publishing classifiers to maven central. Google's protoc for example uses the 'osx' classifier. This will need a configuration property or something for backwards compatibility.
any news?
What do you think about letting a user create a file (.os-mappings.json
in project root) that contains something like this:
{
"copiedProperties": [
{
"src": "os.detected.name",
"dest": "os.detected.name.alternative",
"replacements": {
"osx": "macos"
}
},
{
"src": "os.detected.arch",
"dest": "os.detected.arch", // overwrite
"replacements": {
"s390_32": "s390",
"s390_64": "s390x"
}
}
],
"additionalProperties": {
"os.detected.classifier.alternative": "${os.detected.name.alternative}-${os.detected.arch}",
"myCustomProp": "foobar"
}
}
Then, a user could use ${os.detected.classifier.alternative}
for the dependencies with a macos-*
classifier.
Would this custom mappings file allow a developer to pull dependencies from classifiers that were BOTH 'osx' and 'macosx' in their pom? I think that's the minimum requirement. Something like this should be possible:
<!-- uses original 'osx' value -->
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protoc</artifactId>
<classifier>${os.detected.classifier}</classifier>
</dependency>
<!-- uses alternative 'macosx' value -->
<dependency>
<groupId>org.bytedeco.javacpp-presets</groupId>
<artifactId>opencv</artifactId>
<classifier>${os.detected.classifier.alternative}</classifier>
</dependency>
For extra credit, hypothetically what if there were three or more distinct values for classifier? Can this solution produce those variants? Maybe we need something like: ${os.detected.classifier.alternative.1}
and ${os.detected.classifier.alternative.2}
etc.?
Would this custom mappings file allow a developer to pull dependencies from classifiers that were BOTH 'osx' and 'macosx' in their pom? I think that's the minimum requirement.
Yeah, that's what the example .json
file tries to show.
For extra credit, hypothetically what if there were three or more distinct values for classifier?
Yeah, something like this:
{
"copiedProperties": [
{
"src": "os.detected.name",
"dest": "os.detected.name.alternative.1",
"replacements": {
"osx": "macos"
}
},
{
"src": "os.detected.name",
"dest": "os.detected.name.alternative.2",
"replacements": {
"osx": "apple"
}
}
]
}
Perfect. Seems like a really nice solution then! +1 Thanks for the explanation.
any news?
What do you think about letting a user create a file (
.os-mappings.json
in project root) that contains something like this:{ "copiedProperties": [ { "src": "os.detected.name", "dest": "os.detected.name.alternative", "replacements": { "osx": "macos" } }, { "src": "os.detected.arch", "dest": "os.detected.arch", // overwrite "replacements": { "s390_32": "s390", "s390_64": "s390x" } } ], "additionalProperties": { "os.detected.classifier.alternative": "${os.detected.name.alternative}-${os.detected.arch}", "myCustomProp": "foobar" } }
Then, a user could use
${os.detected.classifier.alternative}
for the dependencies with amacos-*
classifier.
I create .os-mappings.json
in project root, but it's doesn't work