Fork me on GitHub

Home Forums JSweet Discussion Failed to run HelloWorldAdapter demo

This topic contains 4 replies, has 3 voices, and was last updated by Avatar dpaddock 12 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2108
    Avatar
    Anonymous

    According to the document, I created a HelloWorldAdapter.java in jsweet_extension folder, however, mvn generate-sources show me the following error:

    [ERROR] Failed to execute goal org.jsweet:jsweet-maven-plugin:2.2.0-SNAPSHOT:jsweet (generate-js) on project jsweet-quickstart: transpilation failed: java.lang.ClassNotFoundException: HelloWorldAdapter -> [Help 1]

    Is there anything I need to do to fix this issue?

    Thanks
    Jason

    #2110
    Avatar
    Louis Grignon
    Keymaster

    A simple workaround if you are using the JSweet maven plugin is to include the .java in a source package.
    And declare its full name in the pom.xml, option factoryClassName

    Please tell me if ok for you

    #2111
    Avatar
    Anonymous

    Thanks Louis, I set the following configuration for JSweet maven plugin:

    <includes>
    <include>jsweet_extension/HelloWorldAdapter.java</include>
    <includes>
    <factoryClassName>HelloWorldAdapter</factoryClassName>

    However, there are still some error after run mvn generate-sources:

    [ERROR] Failed to execute goal org.jsweet:jsweet-maven-plugin:2.2.0-SNAPSHOT:jsweet (generate-js) on project jsweet-quickstart: failed to create transpiler: cannot find or instantiate factory class: HelloWorldAdapter (make sure the class is in the plugin’s classpath and that it defines an empty public constructor) -> [Help 1]

    Thanks

    #2112
    Avatar
    Anonymous

    Some time errors appear when build HellowWorldAdapter, but it doesn’t always happen.

    C:\Users\jason\Desktop\jsweet\jsweet-quickstart\jsweet_extension\HelloWorldAdapter.java:1: error: package org.jsweet.transpiler.extension does not exist
    import org.jsweet.transpiler.extension.PrinterAdapter;
    ^
    C:\Users\jason\Desktop\jsweet\jsweet-quickstart\jsweet_extension\HelloWorldAdapter.java:3: error: cannot find symbol
    public class HelloWorldAdapter extends PrinterAdapter {
    ^
    symbol: class PrinterAdapter
    C:\Users\jason\Desktop\jsweet\jsweet-quickstart\jsweet_extension\HelloWorldAdapter.java:4: error: cannot find symbol
    public HelloWorldAdapter(PrinterAdapter parent) {
    ^
    symbol: class PrinterAdapter
    location: class HelloWorldAdapter
    C:\Users\jason\Desktop\jsweet\jsweet-quickstart\jsweet_extension\HelloWorldAdapter.java:6: error: cannot find symbol
    addTypeMapping(java.util.Date.class.getName(), “string”);
    ^
    symbol: method addTypeMapping(String,String)
    location: class HelloWorldAdapter
    4 errors
    [ERROR] failed to create transpiler

    #3699
    Avatar
    dpaddock
    Participant

    I’m running into the same problem trying to follow the steps here using the Quickstart:
    https://github.com/cincheo/jsweet/blob/develop/doc/jsweet-language-specifications.md#hello-world-adapter

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘JSweet Discussion’ is closed to new topics and replies.