Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefix os.detected.classifier property on mac #20

Open
jkirsch opened this issue Mar 7, 2016 · 10 comments
Open

Prefix os.detected.classifier property on mac #20

jkirsch opened this issue Mar 7, 2016 · 10 comments
Assignees

Comments

@jkirsch
Copy link

jkirsch commented Mar 7, 2016

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>
@jkirsch jkirsch changed the title Allo w Allow property naming Mar 7, 2016
@jkirsch jkirsch changed the title Allow property naming Prefix os.detected.classifier property on mac Apr 7, 2016
@trustin trustin self-assigned this Jun 22, 2016
@trustin trustin added this to the 1.6.0.Final milestone Jun 22, 2016
@trustin
Copy link
Owner

trustin commented Jun 22, 2016

Sounds like a good idea. Will try to find some time.

@bin01
Copy link

bin01 commented Apr 17, 2017

@trustin I am currently running into a similar issue. Is there any known workaround for this issue?

@taftster
Copy link

taftster commented Jun 2, 2017

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.

@trustin trustin removed this from the 1.6.0.Final milestone Apr 22, 2018
@RobertoUa
Copy link

any news?

@trustin
Copy link
Owner

trustin commented Feb 6, 2021

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.

@taftster
Copy link

taftster commented Feb 6, 2021

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.?

@trustin
Copy link
Owner

trustin commented Feb 7, 2021

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"
      }
    }
  ]
}

@taftster
Copy link

taftster commented Feb 7, 2021

Perfect. Seems like a really nice solution then! +1 Thanks for the explanation.

@juzi214032
Copy link

any news?

@vin188
Copy link

vin188 commented Sep 6, 2022

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.

I create .os-mappings.json in project root, but it's doesn't work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants