@JsType(namespace = JsPackage.GLOBAL, name = "MyLibrary")
public class MyLibrary {
@JsMethod
public static void greet(String name) {
System.out.println("Hello, " + name + "!");
}
@JsMethod
public static int add(int a, int b) {
return a + b;
}
@JsProperty
public static String message = "Hello from Java!";
}
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.gwtproject</groupId>
<artifactId>gwt-j2cl-processor</artifactId>
<version>1.0.0</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>