Help with importing Java sources
I am just starting to play with MPS, a complete novice. I tried importing some Java sources using New Models from Java Sources. The resulting models have unresolved references to annotations defined in a Java library. How do I tell MPS where to find this Java library?
I tried creating a DevKit, added the Java facet, and added the JAR file as a library under the Java tab. I was offered the option to create models, along with a combo box of options that are meaningless to me. I chose java_classes. I added the DevKit as a used language of the model that contains the unresolved references. What more needs to be done?
Thanks in advance...
I tried creating a DevKit, added the Java facet, and added the JAR file as a library under the Java tab. I was offered the option to create models, along with a combo box of options that are meaningless to me. I chose java_classes. I added the DevKit as a used language of the model that contains the unresolved references. What more needs to be done?
Thanks in advance...
Please sign in to leave a comment.
It seems to be related to http://youtrack.jetbrains.com/issue/MPS-19549
For references to get resolved it should be sufficient to have stub models for that library (in your case you were offered to create them when you added it as a library).
I'll be fixing it soon-ish. So far, please try hitting F5 (refresh) if you're in MPS ide, not in idea plugin.
Just in case, java stub models are java top-level structure (classes, fields, methods) recovered from class files (possibly in jars) and represented in models like BaseLanguage classes. They are needed for code written in MPS to reference those "external" things.
While libraries (that you added in module properties) are needed to actually compile against that library.
Alan
(not Settings as you wrote). This is the wrong place to do it.
What you should be doing is projectTab> solution name> Module
Properties>Java>Libraries, once you are there, click the + at the bottom
and pick any number of jar files with the file dialog. If you need the
stubs, as Daniil indicated, do projectTab> solution name> Module
Properties, then click the + to add a model root.
Note that I am using the conventions used in my book (see
http://books.campagnelab.org and the free intro for what these conventions
are).
Fabien
On Thu, Apr 24, 2014 at 10:46 PM, Alan Snyder - Meta Programming System <
jetforum@jetbrains.com> wrote:
--
Fabien Campagne, PhD – http://campagnelab.org
Assistant Professor, Dept. of Physiology and Biophysics
Institute for Computational Biomedicine
Associate Director, Biomedical Informatics Core,
Clinical Translational Science Center
Weill Medical College of Cornell University
phone: (646)-962-5613 1305 York Avenue
fax: (646)-962-0383 Box 140
New York, NY 10021
Do you speak next-gen?
See how GobyWeb can help simplify your NGS projects at
http://gobyweb.campagnelab.org
When I do this, I get a Model Roots dialog. MPS can try creating models for the specified locations, so that class files can be referenced from MPS models directly. Would you like to import models for the specified locations?
Should I do this? Which of the offered options should I select:
project
java_classes
default
obsolete
java_source_stubs
I have no idea what these options mean!
Thank you.
Alan
see that you need to pick the Java tab after you open the module properties
(projectTab> solution name> Module Properties>*Java*> Libraries)
This is to add a library. If you need first class models in addition to
just the classes (likely if you don't know the difference), add a model
root as well in the Common tab. I am adding a section to the book to
clarify what the various options mean. For now, I assume you want to import
a JAR file, then pick java_classes. (All of this is easier to explain with
screen snapshots.)
On Thu, Apr 24, 2014 at 11:36 PM, Alan Snyder - Meta Programming System <
jetforum@jetbrains.com> wrote:
--
Fabien Campagne, PhD – http://campagnelab.org
Assistant Professor, Dept. of Physiology and Biophysics
Institute for Computational Biomedicine
Associate Director, Biomedical Informatics Core,
Clinical Translational Science Center
Weill Medical College of Cornell University
phone: (646)-962-5613 1305 York Avenue
fax: (646)-962-0383 Box 140
New York, NY 10021
Do you speak next-gen?
See how GobyWeb can help simplify your NGS projects at
http://gobyweb.campagnelab.org
No, the dialog is from the Java tab:
I selected java_classes, then went to the Common tab and added java_classes as a model root.
However, I am not seeing any evidence that a model was created from the JAR. Nothing new shows up in the right side pane of the Common tab.
Alan
yet have a model root configured for these jars. I was trying in a project
where the model root was already configured.
On Fri, Apr 25, 2014 at 9:46 AM, Alan Snyder - Meta Programming System <
jetforum@jetbrains.com> wrote:
--
Fabien Campagne, PhD – http://campagnelab.org
Assistant Professor, Dept. of Physiology and Biophysics
Institute for Computational Biomedicine
Associate Director, Biomedical Informatics Core,
Clinical Translational Science Center
Weill Medical College of Cornell University
phone: (646)-962-5613 1305 York Avenue
fax: (646)-962-0383 Box 140
New York, NY 10021
Do you speak next-gen?
See how GobyWeb can help simplify your NGS projects at
http://gobyweb.campagnelab.org
The module where the JAR is used is a Solution, not a Language. It does not have an "all models" element in the Project tab.
Have you placed the jar files you need to import into the solution/language folder, next to the .msd file? Doing so will help you see the jar files immediately in the right panel after you have created the model root. If you don't put them there, you have to use the UI of the right panel to change the directory for the model root.
When you see the file, make sure they are not excluded, but in the state `Model' (top of the right panel toggles).
Alan