Setup IntelliJ IDEA 12 with Play2 and framework sources (java) - intellij-idea

I'm using IntelliJ IDEA 12, its Play2.0 plugin for a Java project.
Unfortunately Play 2 (2.1.4 at this time) does not ship with the sources for its dependencies, and running idea with-sources=yes only downloads the project's dependencies sources.
So far I've had to manually download the source jars and attach them whenever I needed them.
Of course I have to redo this every time the Play framework is updated.
Is there any better way, either within play, which I would prefer, or with an external solution?
Unfortunately IDEA's "Search in internet..." button usually doesn't work, most likely because it's looking on the wrong respositories. I suspect it is trying to use the Maven settings with the configured Nexus repos, but AFAIK Maven central is not in there.

It is as simple as running update-classifiers in the Play console and then regenerating the project files.
I wish this would be done automatically, but apparently it is too obvious to sbt users.

Related

Cannot add framework support in IntelliJ 14 Ultimate

I found a pretty old post with this question but unfortunately he didn't get any help. I hope someone can assist me.
I created a repo at GitHub. After cloning it to my computer I tried to add the following framework support: Maven, JSF, EJB, CDI, etc. I know I could add the files manually. But, I want to use what the IDE has to offer.
However, the only framework showing up is SQL, which is different from this post from stackoverflow and from their documentation.
Has anyone had this same problem and got it working?
Intellij reacts to changes in your Maven pom.xml file. Maven does not react to changes in your IntelliJ project module settings.
The steps that you should follow here are
Close IntelliJ
In a command shell, clone your Github repository.
Using an editor external to IntelliJ such as VI or Notepad, create a pom.xml in the root directory. Better yet, use a Maven Archetype to generate your pom.xml.
Now open IntelliJ. Choose File, New, Project From Existing Sources. Navigate to your pom.xml and follow the prompts.
I recommend checking Search for projects recursively and Import Maven projects automatically.
Finish the project creation.
Now, add dependencies to your pom.xml via the dependencies tag. See Maven Dependencies. Intellij will automatically react to dependencies that you add as long as it can see a Maven Repository on your local machine or on your network or on the Internet.
I know it is a little bit to late but I just post it because it is still an possible issue: You need to open YourProjectName.iml and make sure that the type (<module type="JAVA_MODULE" version="4">) is JAVA_MODULE and not something else!(In my case it was WEB_MODULE)

Having IntelliJ IDEA auto-download libraries from Maven

I've set up a Scala project in IntelliJ idea with several dependency libraries auto-downloaded by the IDE from Maven repositories, using the built-in support for this functionality. The libraries are then automatically downloaded into a local folder and everything works as expected.
My problem is when some of those libraries go missing- either because I've deleted them, or because I'm pulling the project from a clean machine and the library binaries aren't included in version control. I'd like to tell IDEA to automatically re-download all dependency libraries from the Maven repository; I know this is possible because all the necessary information can be found in the .iml file.
If I manually go to every library in the "Project Structure" dialogue and click "Edit," I can repeat the original workflow to redownload from Maven repo without touching any settings. This is inconvenient when there are many libraries, though. Is there any way to tell IDEA to just do this for me for all Maven repo libraries included in the project?
It would be easier to use Apache Maven and maintain a pom file with a list of all dependencies (with the possibility to keep it in source control, etc) which you can simply reimport whenever you need to. IntelliJ and Maven will then manage all your libraries for you, along with their javadocs and sources. There are many, many, other benefits from this approach -- it is highly recommended.

How do you link an eclipse project to an eclipse plug-in project?

I am building an eclipse plug-in project that acts as a front end. I also have a separate eclipse project that runs as a backend. Right now I can run each of them separately and they communicate just fine using sockets.
I would like the plug-in to create the major components of the back end when it starts but also keep the two projects separate so that I can use other editors to communicate with the back end. So, I added the back end eclipse project to the build properties of the plug-in project and I added some code from the back end driver to the plug-in activator's start(). However, when I run the plug-in project I am getting class not found exceptions for all back end references. It appears to compile fine, but I can't run it. I do not do anything to the MANIFEST.MF file in the plug-in project.
How does one add a second java project to an eclipse plug-in project?
There are several ways you can do this, going from best and most difficult to worst and easiest:
(1) Use a build tool (such as the built-in ANT, or tycho, or (as I'm sure there are) some other). This is by far the best solution, but is quite a bit more involved than the next 2.
(2) Convert your non-plugin project to a plugin project and add it as a plugin dependency in your plugin settings file's dependencies tab
(3) Export your non-plugin to a new .jar in your plugin project directory (e.g. $project_loc/lib/something.jar); go into plugin settings (plugin.xml) and include it in: The Build tab under binary build, and the Runtime tab under Classpath. (Or edit the corresponding entries in manifest.mf and build.properties)
For most cases I'd recommend approach (1); look up a few tutorials online, there are plenty. (3) is the quick-and-dirty non-flexible workaround to your particular situation, good for nothing other than seeing if it actually can run. (2) is somewhere in between -- obviously not ideal, but not as bad as 3.

Play Framework 2.1 application mounted as an IntelliJ Module

Known is the command to create IntelliJ files needed for a Play application:
play idea with-sources=yes
This generates two folders:
.idea (containing libraries.xml)
.idea_modules
Most of tutorials or simple article on the net explain how to mount the app as an IntelliJ Project.
However, I want to mount it as a Module (as part of an existing project so), thus I've just used the .idea_modules file.
I can't imagine me setting ALL dependencies (more than 100...) manually...
How to deal with the libraries (dependencies)? Indeed, libraries.xml is used in .idea file and typically used when someone want to mount the app as an entire Project.
To put in a nutshell, is there an efficient way to set up a Play app in IntelliJ as a simple Module including automatically all needed dependencies?
It would be great if IntelliJ could implement an SBT feature like the one for Maven in order to import dependencies automatically.

Intellij Idea 12 gradle build

I am trying to build a project with gradle from within Intellij Idea 12 (commercial editon) but this keeps failing. I have the gradle plugin enabled and also the gradle gui plugin. The native project gradle import is working. (I'm not using gradle idea btw.)
When using the bash I only run gradle war to build my web application. Now I want to do the same from within Intellij.
The gradle gui plugin seems to be using the wrong JDK (I guess it's the one Idea uses, a 1.6 JDK) and therefor fails to compile because this is a JDK 1.7 project. And it doesn't integrate well into Idea because it seems like an external build process (like triggering external ant tasks).
What I have done so far is to configure my own artifact in a way that is equivalent to the one gradle war would have build. But that means a lot of configuration and simply feels wrong. There should be a better way?
So what do I have to do to make Idea compile a project in a way similar to the command line gradle task?
JetGradle plugin doesn't provide native tasks support at the moment. It's scheduled for v.12.1 - IDEA-95897. Feel free to track the plugin's news and update it manually as soon as corresponding support is provided.