Month: April 2014
-
Maven JAR Plugin: Excluding Package(s) from JAR
Let’s assume we want to exclude com.choonchernlim.epicapp.scratch package when we create the JAR file. Add the following in pom.xml:- The key here is to specify the execution ID called default-jar. Read More…
-
Spring Security: Handling 403 Error Page
If you are already using Spring, then you might want to use Spring Security to secure your web resources. To do that, we specify the URI to be secured with <security:intercept-url/> tag:- When users without role ROLE_TOPSECRET access /top-secrets/kfc-secret, they will see this default error page:- This proves that Spring Security is doing its job.… Read More…
-
Maven: Enabling Snapshot Downloads
By default, Maven does not allow us to download snapshots. To enable this feature so that we can download snapshots from Nexus, add the following configuration to [USER.HOME]/.m2/settings.xml:- Replace http://snapshots with the actual snapshot link. Read More…
-
Spring: Set Active Profile Using Existing JNDI
If we are using @Profile, Spring allows us select the active profile by using spring.profiles.active key. Although I can hardcode the active profile in web.xml, I want my active profile to be determined based on a JNDI string defined in the application server. PROBLEM My application servers (DEV, QA and PROD) have an existing JNDI… Read More…
-
Spring Web Services: Client Integration Testing with MockWebServiceServer
Spring Web Services provides a great way to perform web service client integration tests. However, the example in the documentation requires the client class to extend org.springframework.ws.client.core.support.WebServiceGatewaySupport, which is rather ugly. Instead, I prefer to have WebServiceTemplate injected into my client class. So, I made a slight tweak to my integration test to work this… Read More…
-
SonarQube: Building Specific Module in Multi-Module Project
Let’s assume we have a multi-module project that looks something like this:- To build certain module(s) within the project, we can use the sonar.skippedModules option to skip the modules we don’t need. For example, the following configuration in Jenkins will only build app-jar module in SonarQube:- Read More…