Candies are of two different kinds:
Cordovaare all packaged as JSweet candies. JS candies contain well-typed Java declarations, which are conceptually similar to header files in C (
Anyone can build a new candy. However, there are places where to find already-made candies.
|Github/jsweet-candies||In this Github organization, you will find all candies that are written and editable as JSweet definitions.|
In this Github organization, you will find all JSweet implementations for Java APIs. These will help the programmers to share Java code between a Java server and a WEB client. They can also help to port legacy Java applications to the WEB. Maven group:
Besides, you can browse our Maven repository to look up for releases and snapshots. Candies are in the
org.jsweet.candies Maven group. J4TS candies are located in
def.libname package so that JSweet understands that it is an API bridge. Declarations in the
def package contain no implementations and all methods are
native methods. They are compile-time entities, which are used by the compiler to ensure typing.
Note that in your JSweet project, you can create your own bridges on the fly just by creating a
def package. Once you want to share these bridges with several projects, you may want to package them as actual candies (Maven artifacts). To get started, you can clone the following template, which contains a basic API bridge example packaged with Maven: jsweet-candy-js-quickstart.
Although it is simple to write your own bridges, it can be quite boring to rewrite all the APIs for a given library. JSweet provides an open source API translator / candy generator that can give you a head start when translating API from TypeScript definition files (
*.d.ts). A TypeScript definition file contains declarations, exactly like JSweet declarations in the
def package, and can be automatically translated to Java.
All JSweet candies are available in our Maven Artifactory: http://repository.jsweet.org/artifactory. You can perform advanced search to find candies and other JSweet artifacts through the Artifactory WEB GUI.
Within our Maven Artifactory, you will get the release and the snapshot repositories. You you must include these repositories in your
pom.xml before declaring dependencies.
<project> ... <repositories> <repository> <id>jsweet-central</id> <name>libs-release</name> <url>http://repository.jsweet.org/artifactory/libs-release-local</url> </repository> <repository> <snapshots /> <id>jsweet-snapshots</id> <name>libs-snapshot</name> <url>http://repository.jsweet.org/artifactory/libs-snapshot-local</url> </repository> </repositories> ... </project>
Candies versions are defined as
qualifier is a unique (and growing) string representing the id of that release. The qualifier may contain the transpiler version, but most often it only contains a date timestamp (
yyyymmdd). Of course, for Maven snapshots, the qualifier is worth
0.0.0-qualifier, which means
unknown (sometimes, the version does not matter because the API never changes).