IDEA: External Tools as a Run Configuration?

Try the Run Configuration For External Tools-plugin.

RunPopup.png

The idea of an empty run configuration type is also provided by Batch Scripts Support– or BashSupport-plugin. So if you already use one of the bash plugins, you do not need my plugin.

Advertisements

IDEA: Build your own Tomcat integration for the free IntelliJ IDEA Community Edition

If you are using the free Community Edition of IntelliJ IDEA you probably noticed that there is no Tomcat support. The integration is included only in the commercial Ultimate Edition.

If won’t buy a license for whatever reason, you still can create some basic Tomcat integration even in the free IDEA Community Edition.

How to start the Tomcat from within the IDE?

Create an ‘External Tool’ configuration for the Tomcat
2017-06-04_12h50_00.png
The command is catalina jpda run to start the tomcat in debug mode at the default port 8000.

Now the Tomcat can be started from several places within the IDE

2017-06-04_14h11_50.png

and even the output of the process is printed to its run console.

2017-06-04_12h53_12.png

Tip: If you want the External Tool to be integrated as a Run Configuration please checkout the other post and plugin.

How to start a debug session for started Tomcat?

Create a run configuration which starts a remote debugging session at localhost:8000

2017-06-04_14h38_58.png

Switch to ‘Logs’ tab and configure that the log files are also integrated2017-06-04_13h04_52.png

After starting the run configuration, the debugger is attached to the Tomcat and the log files of the tomcat are shown within the IDE.

2017-06-04_13h07_01.png

How to deploy a WAR file from a Maven based webapp to the Tomcat?

The steps are to run mvn war:war first to create the WAR and then to copy it to the webapp directory of the Tomcat.

One approach is to create a ‘Maven’ run configuration with the commandline: war:war org.codehaus.mojo:wagon-maven-plugin:upload-single -Dwagon.fromFile=FULL_PATH_TO_WAR_FILE -Dwagon.url=file://FULL_PATH_TO_TOMCAT\webapps\ (Don’t forget to change placeholders!)

This creates the WAR file and copies it to the Tomcat via the wagon-maven-plugin.
2017-06-04_15h28_01.png

Other approaches could be:

  • Create a batch script (which invokes maven and copies the WAR), integrate it as an ‘External Tool’ configuration OR
  • Use the remote synchronizer plugin OR
  • Integrate an Ant target to copy the file OR
  • … more ideas at stackoverflow or here

Alternatives

IDEA: ‘Find duplicated classes in classpath’ plugin

In legacy projects sometimes a Java class (with the same fully qualified name) exists in several projects. If you combine these projects, you will never know, which class is used at runtime. It is like Maven dependency hell.

So I wrote a plugin to find out duplicated classes in the classpath. Get it here https://plugins.jetbrains.com/plugin/9663-find-duplicates-inspection, but do not expect much support from me (because it is only a proof-of-concept).

screenshot_16924.png

NetBeans: How to simplify copy/paste Java code from online tutorials

Some months ago I created a small useful NetBeans plugin, which allows to you to save time when pasting code samples from online tutorials. Today I used it again and I still find it very useful in this specific context. And it saves you time. That is why I want to report about it.

What is the feature? You can copy the Java source code of whole classes from a tutorial and paste it via Menu|Edit|Paste to new file. Either the package declaration of the Java class is taken in account or the Java class is placed in the correct package. This depends on the selected node and it is documented included screencasts at https://github.com/markiewb/nb-paste-to-new-file.

That sounds familiar? Yes, this feature already exists natively in Eclipse JDT and Intellij IDEA.

Give it a try, when using NetBeans! Happy coding.

BTW: I am still looking for maintainers for my plugins! Because of time issues, I will not bugfix nor implement features anymore. Support your favorite IDE and by contribution to your favorite plugin!

PasteToNewJavaFile

How to see HTTP session content using PSI Probe?

You could use PSI Probe.

Drop probe.war into the webapps folder of your Tomcat, open the probe context in the browser (f.e. localhost:8080/probe) and at “Applications|/MYCONTEXT|Sessions|/SESSIONIDXYZ” you can see the session content of session SESSIONIDXYZ of the context MYCONTEXT.

psiprobe