Gwt Production Mode in IntelliJ IDEA - gwt

Specifically, I wonder how to compile project for production mode in IntelliJ IDEA. So far I have found only dev mode mentions and the official JetBrains guide describes only devmode. Now, when I compile my gwt module in IDEA using "Compile module" from context menu and try to run it in browser calling:
localhost:8888/MySampleApplication.html
I always get message "Gwt module need(s) to be recompiled".

I have defined a maven run configuration with the command line:
clean gwt:compile -Dgwt.inplace=true
Now the compiler writes his output in the source directory ( in our case /src/main/webapp). If I take now the url without the parameter for the codeserver I get the correct results.
I hope this will help!

Related

"Stream Processing with Apache Flink" how to run book code from IntelliJ?

As described in this post I have been unable to successfully run any code from the book "Stream Processing with Apache Flink, including the precompiled jar.
It is not my practice to use an IDE but I thought I would try to use IntelliJ as Chapter 3 "Run and Debug Flink Applications in an IDE" describes how to do that specifically for the code for this book.
The book describes a project import process that I have not found a way to use. It describes setting options on import, for example select Maven. I have not found a way to set any options on import.
I am able to import a project and run code. The code fails, looks like with missing dependency. Maybe because it isn't a Maven project?
Here are steps to reproduce
git clone https://github.com/streaming-with-flink/examples-scala.git
Start IntelliJ
Choose "Open or Import" and Select the "examples-scala/" folder. The project imports with no chance to select options.
Now I have a project
Browse to AverageSensorReadings class, open, and run.
Errors with
java.lang.NoClassDefFoundError: org/apache/flink/api/common/typeinfo/TypeInformation
How can I run this code in IntelliJ?
I see that flink dependencies have provided scope in Maven - this means that thay are not included into the classpath when you running the application. Most likely the application is meant to be run on environment where these dependencies already exist (e.g. Hadoop). To be able to run it from from IDE set Include dependencies with "Provided" scope option in Run Configuration:

"Error: Could not find or load main class" when trying to launch Run Configuration in Intellij

In a project that was originally set up for python I do have both python and java SDK's defined:
I am attempting to run a scala program: and the src directory is correctly marked as sources:
The class itself does have a main :
But the Intellij does not provide assist for setting up a Run Configuration - which should have been available by right click/context menu. So I set it up manually:
But when trying to actually run the program it is not successful saying Error: Could not find or load main class com.blazedb.algos.CourseraAlgos:
Update: for reference purposes here is a Run Configuration from a similar project that does work. I do not see any structural differences between the two.
Any ideas why Intellij does not recognize the file as a scala class?
In addition to the steps shown above I had also tried:
adding a new scala-specific module
nuking and recreating the IJ project
These did not resolve the issue. It turns out the problem is that there were no pom.xml in this project. The resulting behavior by Intellij made it difficult to trace down the root cause: there was no message like
You need a pom.xml or a build.sbt to proceed
Apparently stray scala classes (dissociated from a formal build) are only haphazardly supported in Intellij.
So finally the answer is to create a new scala based project. Adding scala back to a project built for python is at the least unreliable and maybe not possible at all.

Running PlayN in HTML DevMode

I'd like to be able to run my PlayN project as a Web Application in DevMode, so that I can use a quick browser refresh to see code changes without having to recompile. From what I'm reading on the wiki and on this question it sounds like that should be possible.
I set up my project using: mvn archetype:generate -DarchetypeGroupId=com.googlecode.playn -DarchetypeArtifactId=playn-archetype -DarchetypeVersion=1.7 and importing the pom.xml into eclipse.
Here's what I can do:
Run from eclipse as a Java Application
Start the server using Maven command line: mvn -Phtml integration-test
While I can do most of my programming in Java and occasionally do the long build to test HTML, I'd love to be able to modify the code while testing HTML without recompiling.
By default, the option to run as a Web Application doesn't show up. I've tried going into the project's properties and checking the "Use Google App Engine" and "Use Google Web Toolkit" options, which creates the "Run As Web Application" option, but when I do so I get "Could not find any host pages in project XXX".
I then attempt to set a WAR directory under Properties->Google-Web Application. However, the closest thing to a WAR in the project is "src/main/webapp". I've tried using that, and I get the error: "The archive: /myproject-assets/src/main/java which is referenced by the classpath, does not exist."
I have the feeling I'm going about this all wrong. Can anyone point me in the right direction? Is what I'm doing even supposed to be possible? Thanks!
It is possible, but just know that in dev mode, playn runs very slow.
I don't know how to do this with eclipse, but with intelli IDEA, you do the following:
you need to create a module with a war artifact (to run as a server)
add the correct gwt libraries so that you can run gwt dev mode server with the aforementioned war module.
choose a GAE server (or, any gwt compatible server actually, this will be the server that runs the aformentioned war module).
run it! see this screenshot http://screencast.com/t/qK4JKvF33V
when you change code, the gwt devmode server should detect it, and automatically recompile (not sure if this needs to be in debug mode - i don't think it does).
you can try doing it via the command line, not sure if works, but this is what intellij runs (i've taken out the intellij specific bits out):
java -cp CLASSPATH_WITH_GAE_DEV_TOOLS_AND_GWT_DEV_TOOLS com.google.gwt.dev.DevMode
-war /path/to/war
-startupUrl Roborally.html com.yourgame.YourGwtEntryModule
-server com.google.appengine.tools.development.gwt.AppEngineLauncher

Eclipse plugin development: Missing dependencies at runtime

Background
I'm currently trying to extend Junit (org.eclipse.jdt) in order to do some tracing.
Therefore I created my own plugin project which (among others) provides a class which should be used by the junit runtime plugin.
I have setup my project as a dependency for junit and the package containing my class is listed as "exported" in my Manifest in the runtime tab. If I run the plugins as an eclipse application everything builds and starts allright and.
Problem
However, if in the started eclipse I perform a "Run as Junit", I get a NoClassDefFoundError concerning my class. In my understanding this means, that at runtime my class is not visible in the started eclipse. I thus printed the classpath while running and like expected my plugin doesn't show up.
Do I have to add my plugin to the "runtime" settings of the junit plugin? In the Manifest, my package is not available under the "export -> add" button. I tried importing a jar of my plugin and configuring those exports manually here, but this did not help either.
My thought process kind of gets stuck with this "run in run" configuration...
Any help is welcome!
Digging deeper in the code I found that the reason for the error is, that the part which calls my code and throws the error is run in a seperately started VM which has its classpath set via code. Nothing was wrong with the configuration, it just was not used in this case.
So if you ever stumble upon a "VMRunnerConfiguration" while having classpath problems, this might be your problem. ;)

sbt & Play 2.0 Debugging Information Missing

I am using sbt to build my Play 2.0 project. I managed to configure sbt to open a debugging port, attach an Eclipse remote debugger and enter a break point. I put the break point into one of my actions. But when the execution stops there, I cannot inspect any variable. I guess that sbt builds the Scala code without debugging information.
Does anybody know how to configure sbt to add debugging information? Or could it be a problem of my Scala IDE plugin for Eclipse or anything else?
Many thanks in advance!
To start Play in debug mode via sbt, run:
sbt -jvm-debug 9999 run
I did not find a solution for all problems I have with debugging but at least it works so that I can use it. Here is my status:
I am using sbt directly and cannot use -jvm-debug 9999. But I added the following to JAVA_OPTS in the sbt launch script:
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9999
This gives the possibility to connect an Eclipse remote debugger and get debugging information (if running Play in development mode).
The problem that still remains is that I don't get the popups showing variable information when pointing the mouse cursor on a variable. But this seems to be a problem with the Scala IDE plugin and not with Play, because I get the variable information in the variables view in the debugging perspective.
I found this to be the easiest solution : (using IntelliJ IDEA )
in IntelliJ :
Go to "edit run configurations"
Create a new remote configuration (port 9999, all other details leave with default values)
Go back to IntelliJ and run the new debug configuration (don't forget to put a break point)
From command line run :
sbt -jvm-debug 9999 run
I had the same problem in a modularized sbt build. Adding
javacOptions ++= Seq("-g")
to the build.sbt file, solved the problem of missing debug information in the compiled classes.