Debugging Arquillian Tests in IntelliJ

Clone the tutorial repository from: https://github.com/arquillian/arquillian-examples In IntelliJ click “File | Open” and select the sub director named “arquillian-tutorial”. After the dependencies are resolve the project structure is shown. Now I can set a breakpoint in a test, right click the test file and click “Debug ‘GreeterTest’”: The stacktrace shows I’m debugging the test using the Arquillian stack. The test was executed in the embedded version of Wildfly as the console window reveals: If we want to remote debug in an running Wildfly instance (daemon or service) we have to modify the start parameters and add “--debug 8000” where 8000 is the port you want to debug.

Maven Archetypes in IntelliJ

IntelliJ has the ability to use Maven as build and project system. The concept of an archetype is a predefined project or project template.When “File | New project” is used to create a new project and “Maven” is selected the following dialog is displayed:IntelliJ comes with a few archetypes but of course custom ones can be added. On the MVN Repository for example several archetypes for Wildfly are available: http://mvnrepository.com/artifact/org.wildfly.archetypeThe XML snipped can be used as copy-paste-source for IntelliJ’s “Add archetype dialog”:After clicking the “OK” button the newly added archetypes are available as a source for the project creation. The custom archetypes are stored in the file “C:\{username}\Daniel\.IntelliJIdea{version}\system\Maven\Indices\UserArchetypes.xml” on Windows and “~/.IntelliJIdea{version}/system/Maven/Indices/UserArchetypes.xml” on Linux. Next define group and artifact identifier as well as version for the new project:Select the Maven version:And the project location:The result is a runnable quick start for working with the Wildfly application server.

Code Snippets in IntelliJ

Code snippets can be helpful. Otherwise the can lead to code duplicates – so use them with wisely.In JetBrains IntelliJ the code snipptes are called Live Templates. They are stored in files saved in C:\Users\{UserName}\.IntelliJIdea{Version}\config\templates on Windows and ~/.IntelliJIdea{Version}/config/templates on Linux. To create a live template open IntelliJ and open the Settings from the File menu:In the Settings dialog you can use the search text box to quickly access the Live Templates section:Now just select the Language and use the green plus button on the upper right to add a new one (like the iife that I just added here).There is a special placeholders that can be used aside from variables:$SELECTION$The Edit variables button switches to enabled state as soon as you user a variable name in the code.