How to use SBT to create an IDEA plugin project? - scala

We can use IntelliJ-IDEA to import an normal SBT project easily, but I'm trying to write an IDEA plugin project with Scala, and I want to use SBT to manage it(the dependencies).
But now I don't know how to do it, and not sure if it's possible, so I have to use IDEA to create an IDEA plugin project manually, and commit the .idea/* files to git, which is not good.
Is it possible to use SBT to create an IDEA plugin project?

I am not sure how the exact code would look. But the play framework does something like what you want. They let you create an IDEA project with
[My first application] $ idea
So you can .gitignore the .idea/* folder and every developer can easily create their own IDEA project if they want to use an IDE.
Their documentation describes how you use it, so it should be easy enough to find the code that actually generates the project: https://www.playframework.com/documentation/2.0/IDE

Related

How to import an eclipse based project from GitHub into Intellij properly

I want to import a maven project from GitHub into intellij which in of itself I know how to do however, the project this time was created initially also as an eclipse project and I want to be able to work on it in idea while my team members work on it in eclipse without causing conflicts due to differing project file structures. How can this be done?
When checking it out in Intellij it does ask me if I want to create a project from it and select yes but next, it asks whether to create the project from the existing sources vs from external model. From the external model option it allows me to pick eclipse or maven but not both. Do I just create from existing sources? Which is my best option to do this without screwing it up for the others when I commit and push my changes?
I understand that the easy answer might be: "just use eclipse" however, I think the answer on how to properly do this could be useful later. Not only me but also for others who want to work with the IDE they are most familiar and productive with and not mess with the workflow.
Any help would be appreciated
When importing an Eclipse project into IntelliJ, you have the option to:
Create module files near .classpath files
Keep project and module files in
The idea is to keep your *.iml file concurrently with your Eclipse .project/.classpath (and you can keep them in sync).
That way, you can open the project in both IDE.

Scala Export/import macro project

I´ve been googling but I could not find a good documentation.
I create a project with an entry API using macros, but now since I cannot use it even from my own project I need to export it.
Anybody please can point me to a good documentation/blog where explain how to export/import a macro project with intellij?.
Regards.
You don't need to do anything special. Just build it and use it as a dependency of other projects. If you are using SBT, run command sbt publishLocal. Also, you can use macros in other modules of a multi-module project, or in tests (if they are defined in main sources).

How I can create a scala application in InteliJ and create a scala clas(Ubuntu) ?

Hi i want to create a first little application with scala in InteliJ. My System is Ubuntu.
I install the Scala Plugin and create a new Project (Scala -> SBT )but if I want add a scala class I dont see this option :(
I think i need the scala sdk but where and how i bind them. Why it doesnt install by the plugin :/
First, if you are going to use SBT, auto-import might be a good idea. Else, you would want to manually import (see SBT tool to the right) to produce a stable, usable project.
Second, you mostly don't need to add java classes on the project folder, which is for the build project itself. You should be seeing a src/main/scala folder there instead. Try refreshing the view (right click menu, synchronize)

Generating Scala Play project for IntelliJ

I am new to Play Framework. I wished to make a simple hello world project using SBT (without activator), but unless I did something wrong it seems to me that not all of the files and folders are generated.
Followed the instructions here: http://www.playframework.com/documentation/2.3.x/IDE
Can anyone direct me to some resource that could help me?
Thank you!
First, follow "Create a new application without Activator" section here:
http://www.playframework.com/documentation/2.3.1/NewApplication
Then run "idea" in SBT console to generate .idea and .idea_modules directories with IntelliJ IDEA configuration. Afterwards, use File - Open dialog in the IDE.
The steps above will create an empty application. You will have to create a controller, a view and routes file yourself if you don't want to install activator. Still I advise you to install activator where you'll find plenty of templates including "hello playframework" that would fit your needs.

Scala Code Reuse Between Projects

I would like to use code that I wrote for one project in another project, and it seems like the best way to go about doing this is to use packages, but I'm not exactly sure how, and the documentation I found from my googling on this is pretty unclear. Should I sbt package and then copy the .jar into the project I want to use the code for? How does my build.sbt file need to augmented to do this? If the projects are in the same level directory, is there an easier way of doing this?
SBT has a publish-local command that will package and install you jar file in a local repository. Then you can reference you jar as you would any other dependency.
https://github.com/harrah/xsbt/wiki/Publishing