I’m trying to create a java strategy to use inside of my Spoofax language. Inside the editor the imported jars are working fine, however when building the project I get the following error:

compile-java-files:
      [delete] Deleting directory C:\development\DSL\DSL\SCLT\target\classes
       [mkdir] Created dir: C:\development\DSL\DSL\SCLT\target\classes
       [javac] C:\development\DSL\DSL\SCLT\build.generated.xml:481: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
       [javac] Compiling 8 source files to C:\development\DSL\DSL\SCLT\target\classes
       [javac] ----------
       [javac] 1. ERROR in C:\development\DSL\DSL\SCLT\editor\java\SCLT\strategies\load_spec_data_0_0.java (at line 10)
       [javac] 	import research.ch.cern.unicos.utilities.IDeviceInstance;
       [javac] 	       ^^^^^^^^
       [javac] The import research cannot be resolved
       [javac] ----------
       [javac] 2. ERROR in C:\development\DSL\DSL\SCLT\editor\java\SCLT\strategies\load_spec_data_0_0.java (at line 11)
       [javac] 	import research.ch.cern.unicos.utilities.IDeviceType;
       [javac] 	       ^^^^^^^^
       [javac] The import research cannot be resolved
       [javac] ----------
       [javac] 3. ERROR in C:\development\DSL\DSL\SCLT\editor\java\SCLT\strategies\load_spec_data_0_0.java (at line 12)
       [javac] 	import research.ch.cern.unicos.utilities.XMLInstancesFacade;
       [javac] 	       ^^^^^^^^
       [javac] The import research cannot be resolved

...

       [javac] 12 problems (12 errors)

BUILD FAILED
C:\development\DSL\DSL\SCLT\build.generated.xml:481: Compile failed; see the compiler error output for details.

Where the compiler error occurs at:

<javac srcdir="${src-dirs}" destdir="${build}" source="1.7" target="1.7" debug="on">

I changed the build path, and the plugin.xml to include the appropriate libraries, as was required in Spoofax 1.1 (I got it working there). Has there been a change in how to declare externally imported jar files, or could it be that the functionality is broken?

Submitted by Jeffrey Goderie on 25 September 2015 at 14:47

On 28 September 2015 at 11:26 Gabriël Konat commented:

I think you need to set the externaljar property in your build.main.xml file to have it compile Java files with a JAR on the classpath.


On 28 September 2015 at 12:37 Jeffrey Goderie commented:

I tried this, then it does indeed compile fine, but the only thing that happens is that the jar gets copied to the /include folder. When trying to call the newly created function using Stratego one gets ClassNotFoundException. In Spoofax 1.1 the classes from the imported jar got added into the final jar, but this does not seem to be the case anymore. Is there an extra step that has to be done after compilation?


On 28 September 2015 at 12:57 Gabriël Konat commented:

You must also add that JAR as provider to your main esv file, that will make it available to the Stratego runtime.


On 28 September 2015 at 14:04 Jeffrey Goderie commented:

Adding it as a provider works, and it fixed the issue.


On 28 September 2015 at 14:21 Gabriël Konat closed this issue.

Log in to post comments