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

How do you build it? #17

Closed
ptahchiev opened this issue Dec 29, 2020 · 16 comments
Closed

How do you build it? #17

ptahchiev opened this issue Dec 29, 2020 · 16 comments
Labels
Milestone

Comments

@ptahchiev
Copy link
Contributor

Please specify in the README instructions to build this project.
I tried with:

Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T18:06:16+03:00)
Maven home: /usr/share/maven/apache-maven-3.6.2
Java version: 11, vendor: Oracle Corporation, runtime: /dev/shm/jdk-11
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-58-generic", arch: "amd64", family: "unix"

but I got

[INFO] Units of Measurement Health Module ................. FAILURE [  0.025 s]
[INFO] Units of Measurement for Imaging ................... SKIPPED
[INFO] Units of Measurement Retail Quantities ............. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.750 s
[INFO] Finished at: 2020-12-29T14:07:04+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project uom-health: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed: Unsupported major.minor version 56.0 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project uom-health: Execution default-compile of goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed: Unsupported major.minor version 56.0
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)

Then I found out this one:
codehaus-plexus/plexus-languages#32
and it seems a bug in plexus-languages. So I upgraded the java version to 12, but now I get this:

[INFO] Units of Measurement Health Module ................. FAILURE [  0.261 s]
[INFO] Units of Measurement for Imaging ................... SKIPPED
[INFO] Units of Measurement Retail Quantities ............. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.509 s
[INFO] Finished at: 2020-12-29T14:15:26+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project uom-health: Compilation failure: Compilation failure: 
[ERROR] /home/petar/workspace/uom-domain-master/health/health/src/main/java/tech/uom/domain/health/types/BMIRange.java:[39,27] package tech.uom.lib.common.function is not visible
[ERROR]   (package tech.uom.lib.common.function is declared in module tech.uom.lib.common, but module tech.uom.health does not read it)
[ERROR] /home/petar/workspace/uom-domain-master/health/health/src/main/java/tech/uom/domain/health/types/BMIRange.java:[47,8] cannot access tech.uom.lib.common.function.MinimumSupplier
[ERROR]   class file for tech.uom.lib.common.function.MinimumSupplier not found
[ERROR] /home/petar/workspace/uom-domain-master/health/health/src/main/java/tech/uom/domain/health/types/BMIRange.java:[52,23] cannot access tech.uom.lib.common.function.MaximumSupplier
[ERROR]   class file for tech.uom.lib.common.function.MaximumSupplier not found
[ERROR] /home/petar/workspace/uom-domain-master/health/health/src/main/java/tech/uom/domain/health/types/BMIRange.java:[33,1] cannot access tech.uom.lib.common.function.QuantityConverter
[ERROR]   class file for tech.uom.lib.common.function.QuantityConverter not found
[ERROR] /home/petar/workspace/uom-domain-master/health/health/src/main/java/tech/uom/domain/health/types/BMIRange.java:[31,1] cannot access tech.uom.lib.common.function.UnitSupplier
[ERROR]   class file for tech.uom.lib.common.function.UnitSupplier not found
[ERROR] /home/petar/workspace/uom-domain-master/health/health/src/main/java/tech/uom/domain/health/types/HeartRateAmount.java:[44,14] cannot access tech.uom.lib.common.function.ValueSupplier
[ERROR]   class file for tech.uom.lib.common.function.ValueSupplier not found
[ERROR] /home/petar/workspace/uom-domain-master/health/health/src/main/java/tech/uom/domain/health/unit/Health.java:[62,8] cannot access tech.uom.lib.common.function.Nameable
[ERROR]   class file for tech.uom.lib.common.function.Nameable not found
[ERROR] /home/petar/workspace/uom-domain-master/health/health/src/main/java/tech/uom/domain/health/types/BMIRange.java:[138,9] method does not override or implement a method from a supertype
[ERROR] /home/petar/workspace/uom-domain-master/health/health/src/main/java/tech/uom/domain/health/unit/Health.java:[75,49] cannot access tech.uom.lib.common.function.PrefixOperator
[ERROR]   class file for tech.uom.lib.common.function.PrefixOperator not found
[ERROR] -> [Help 1]
@ptahchiev
Copy link
Contributor Author

I was able to build it by adding some extra requires tech.uom.lib.common; in the module-info

@ptahchiev
Copy link
Contributor Author

Does this need to be fixed? Do you want me to submit a PR?

@keilw
Copy link
Member

keilw commented Dec 29, 2020

Hi, this is a bug in Java 11 as well despite its LTS label it isn't as stable as sugested, especially with Jigsaw and Multi-Release-JARs.
The bug is summarized and pointed to here: https://stackoverflow.com/questions/53581799/jdeps-command-use-with-multi-release-option-failed

I cannot say for sure, what is the other issue, because it seems to fail even in Java 14 while Multi-Release-JAR problems we saw in the past no longer showed in
Please use Java 9 for now, it works perfectly fine with that.

@keilw
Copy link
Member

keilw commented Dec 29, 2020

If you found additional imports in the module-info that work above Java 11, please do, the issue you saw first ist a known problem in the JDK.

@ptahchiev
Copy link
Contributor Author

Thank you for your reply. I have created a PR to fix the build but I now have a new question. I add the uom-retail-quantity dependency to my pom.xml and I expect to be able to use the new units box, each and crate automatically. However, when I try to parse from string:

ServiceProvider.current().getFormatService().getUnitFormat().parse("box");

I get a MeasurementParseException because the unit is not found. I see none of the modules in the uom-domain project declare a javax.measure.spi.ServiceProvider and I was wondering if I have to declare one in my project. Or is it a missing feature? I mean I would expect each of the modules in this project to declare their own ServiceProvider to automatically register the units that it provides.

@ptahchiev
Copy link
Contributor Author

Oops - closed by mistake

@ptahchiev ptahchiev reopened this Jan 1, 2021
@keilw
Copy link
Member

keilw commented Jan 1, 2021

But why reopen it, wasn't it fixed by your PR #18?

@sroze
Copy link

sroze commented Jan 4, 2021

@keilw any chance you could do a release with that fix? 🙏 Thank you!

@keilw
Copy link
Member

keilw commented Jan 4, 2021

We are quite flexible here so I guess together with #16 this justifies a 2.1 release any time soon.

@keilw
Copy link
Member

keilw commented Jan 4, 2021

There is however a possible alignment with issues like unitsofmeasurement/uom-systems#177 but it could be done in a 2.1.1 release. So far this library seems independent of uom-systems, it may change in the future.

@ptahchiev
Copy link
Contributor Author

I want to test it before I close the issue. However I don't know how to use the new units. From above:

However, when I try to parse from string:

ServiceProvider.current().getFormatService().getUnitFormat().parse("box");

I get a MeasurementParseException because the unit is not found. I see none of the modules in the uom-domain project declare a javax.measure.spi.ServiceProvider and I was wondering if I have to declare one in my project. Or is it a missing feature? I mean I would expect each of the modules in this project to declare their own ServiceProvider to automatically register the units that it provides.

@keilw
Copy link
Member

keilw commented Jan 4, 2021

As of now there is no SystemOfUnits implementation that would even know a unit BOX.

@ptahchiev
Copy link
Contributor Author

But what would be the right approach - provide one with the module, or let the customer create his own. If you opt for the first one I can create a PR

@keilw keilw added the domain label Jan 4, 2021
@keilw
Copy link
Member

keilw commented Jan 4, 2021

Maybe similar to https://github.com/unitsofmeasurement/uom-domain/tree/master/health/health/src/main/java/tech/uom/domain/health/unit in "health" this might help, but note even in "health" there is no full integration with the SPI yet, but unless you go all the way of adding a custom formatter, check out https://github.com/unitsofmeasurement/uom-systems/blob/master/unicode/src/main/java/systems/uom/unicode/CLDR.java and see how SimpleUnitFormat is configured there, that might be sufficient, but keep in mind, it only works for SimpleUnitFormat.

@keilw
Copy link
Member

keilw commented Jan 4, 2021

Needs #14

I can fix it for Health, if you would like to create a PR for the "retail" module, there should be no conflicts.
I'll work on #2 and #16 but it is not necessary to recognize those new units to integrate the system with the SPI, that is the cherry on the cake if you want.

@keilw keilw added this to the 2.1 milestone Jan 4, 2021
@keilw
Copy link
Member

keilw commented Jan 5, 2021

Imaging has a dependency already, so we should not release a 2.1 of this module before systems-uom 2.1 was released first.

@keilw keilw closed this as completed Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants