IntelliJ IDEA Working Directory

When you’re switching from one IDE to another, even if the codebase is the same, some differences might occur. This happens e.g. when using relative paths. Assume you have a multi-module Maven project with a structure somewhat like below: +—myApp | \—myApp.component | \—myApp.component.business Trying to execute in IDE the following code present in the myApp.component.business: private final String POM_PATH = "pom.xml"; // ... PomEquippedResolveStage Maven.configureResolver() .workOffline() .loadPomFromFile( POM_PATH ); In Eclipse, by default, it will load the pom....

September 26, 2014 · 1 min

Using JGroups Directly From JBoss AS 7 Component

UPDATE (5.08.2013) – I’ve updated this post to support JBoss EAP 6.1 Final (JBoss AS 7.2). Enjoy UPDATE (2.09.2013) – Bela Ban pointed to his very interesting post about new ForkChannel feature and easy channel hijacking directly from JBoss AS / Infinispan. Read about it here JGroups is Bela Ban’s piece of software for reliable message exchange that is highly configurable and can use either TCP or UDP as a transport protocol....

February 24, 2013 · 5 min

Filtered Resources in Maven

Maven has some really great features. One of them is filtered resources. Basically, if you use Maven for some time, I’m sure you know what by default everything you put in src/main/resources will be added to the classpath in the resulting artifact (e.g. in the WEB-INF/classes for a *.war archive.) Putting resources in this location is a common way of adding Java properties file to your project. Now what is interesting: you can use Maven variables in those resource files and they can be swapped into final value during the process-resource phase....

October 14, 2012 · 2 min

Creating Maven Repository on Shared Hosting

You can easily create a fully functional, basic Maven repository on your web hosting provider’s account. It will give others the possibility to access your released artifacts using clean URLs (like yoursite.com/maven or maven.yoursite.com) or use it as a repository straight from the Maven. To achieve it, you’ll need to: create Maven FTP user, create a subdomain (optional), add Maven server configuration, add distribution management to your pom.xml, add Maven FTP wagon provider, use your repository in client projects....

October 4, 2012 · 4 min

Inject Java Properties in Java EE Using CDI

The aim of this post is to show you how, using CDI, you can inject Java properties entries (those in *.properties files) directly into your Java class. This is somewhat similar to the Spring’s @Value annotation I needed in my plain Java EE project. The whole code can be found on GitHub so feel free to clone it, use it or make any changes you like. Context Ok, so basically in a Java EE environment we already have a way to define some properties that are deployment-specific – it’s the <env-entry> element in the descriptor....

June 17, 2012 · 12 min

Git and empty directories

I’m currently under the process of moving all my workplace repositories from SVN to Git (configured to work with Gerrit). As a side not, I already found it to be a great tool for code review, line-precise commenting of the artifacts and for reviewing new employees code before pushing the changes to the repository. But, back to my point. Recently I’ve stumbled upon a problem with committing an empty directory in Git....

April 21, 2012 · 2 min

Maven Surefire -- Integration tests recognition

By default, Maven’s test plugin Surefire doesn’t scan files for @Test annotations, but rather takes only the files which class names ends with “Test” or “TestCase”. I use both: unit tests and integration tests. I execute the latter using Arquillian framework, so it looks just like pure JUnit test. However, I prefer to name them with the “IT” suffix which means that they’re no longer recognized by Surefire plugin as test files....

February 28, 2012 · 1 min

Hibernate3 and Maven2

Tonight I’ve fought with making Maven and Hibernate to cooperate… After 1,5h struggle, I’ve decided to write down what I’ve “discovered”. When adding dependencies to your persist module you should avoid adding the hibernate package dependency itself as there should be only hibernate-annotations one. When adding log4j dependency remember that version 1.2.15 is messed up and forces you to download jars from SUN webpages if you want to get rid of those nasty dependency errors that maven throw in your face… Instead of 1....

May 30, 2009 · 1 min