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:

https://mps-support.jetbrains.com/hc/en-us/community/posts/115000709744-It-cannot-be-calculated-in-which-module-s-output-path-the-class-file-for-must-be-placed?input_string=Java%20source%20stubs%3A%20It%20cannot%20be%20calculated%20in%20which%20module%27s%20output%20path%20the%20class%20file%20must%20be%20placed

 

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.

1 comment
Comment actions Permalink

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.

0

Please sign in to leave a comment.