Java source stubs: It cannot be calculated in which module's output path the class file must be placed
Hello,
I am trying to use Java source code by adding it to a Solution as Java source stubs. However I have the error:
It cannot be calculated in which module's output path the class file for yajco.ytm.yajco.translation.Main must be placed
And also when trying to use the stubs:
yajco\ytm\mps\plugin\plugin\ImportYajcoAction_Action.java : The import yajco.ytm.yajco.translation.Main cannot be resolved (line: 17)
yajco\ytm\mps\plugin\plugin\ImportYajcoAction_Action.java : Main cannot be resolved to a type (line: 58)
This issue is probably related to the following thread:
However the solution where I put the stubs in is named "yajco.ytm.yajco.translation". The Properties of the solution look like this:
And the tree in the logical view like this (I was not sure whether I need an empty model with the same name, I tried model with the full name "yajco.ytm.yajco.translation" and only "translation" with the preceding virtual package):
Also sometimes the java classes in the stubs directory disappeared and only the *@java_stub empty models were left. Maybe cache invalidation fixed this.
Thanks for any quick advices in advance
EDIT: I assumed, that somehow the module (solution) name must be the same as the stub to be imported (yajco.ytm.yajco.translation). However this was not mentioned on https://www.jetbrains.com/help/mps/getting-the-dependencies-right.html#addingexternaljavaclassesandjarstoaproject-runtimesolutions. Please correct me if I am wrong, or show me a step by step guide how to import java sources.
Please sign in to leave a comment.
The issue is resolved by marking as source root the `src/main/java` directory (maven convention), so the directory right above code packages. Meaning if your class fqn is `example.Main`, you need to mark the directory in which `example` is in.