问题
JSR 275 seems to be in a rejected state. JScience seems to have an implementation and there seems to be unitsofmeasure.
- Are there any other open source implementations?
- Which package is jsr-275 compliant and easy to use.
回答1:
Since the JSR-275 has been rejected the javax namespace cannot be used and has been replaced by the namespace org.unitsofmeasurement. The JScience implementation has been released, latest as of this writing is version 4.3.1 in Oct 2012. Cheers, Jean-Marie Dautelle (JScience project owner)
回答2:
While JScience also plans to implement it at some point, please note JSR 363, the new Units of Measurement standard for Java (successor to JSR 275) is available in Early Draft stage, see http://unitsofmeasurement.github.io/ You'll also find the API and RI in places like MavenCentral.
Werner (Co Spec Lead, JSR 363)
回答3:
As @WernerKeil mentioned, the replacement seems to be JSR 363. I did a bit of research (this stuff is hard to find, scattered around everywhere with no clear overview, which is why I post this here) and it appears that you'll want to bring in the released unitofmeasurement dependency, e.g. from Maven like this:
<dependency>
<groupId>javax.measure</groupId>
<artifactId>unit-api</artifactId>
<version>1.0</version>
</dependency>
Then in the final application you'll want an implementation, such as the reference implementation, e.g. from Maven:
<dependency>
<groupId>tec.units</groupId>
<artifactId>unit-ri</artifactId>
<version>1.0.2</version>
</dependency>
I haven't tried this yet, but that looks the most promising so far.
来源:https://stackoverflow.com/questions/4224122/which-jsr-275-units-implementation-should-be-used