maven

A collection of 35 posts

A Java geek
  • Me
  • Books
  • Speaking
  • Mentions
  • Focus
Mar 9, 2025 maven dependencies

Improving Maven's dependency:analyze... or not

Recently, my good friend Richard Fichtner advised using the mvn dependency:analyze command to get rid of declared but unused dependencies: There is another use case for mvn dependency:analyze It can show you the dependencies you use in your code but have not declared in your pom.xml. This works because you have a transitive dependency on your classpath. Either don't use the dependency or declare it.[image or embed]— Richard Fichtner 💻☕ (@richard.fichtner.

Nicolas Fränkel
Aug 6, 2023 ant maven gradle build

My final take on Gradle (vs. Maven)

I tweet technical content that I consider interesting, but the funny tweets are the ones that get the most engagement. I attended the JavaLand conference in March, stumbled upon the Gradle booth, and found this gem: Things have changed a lot 😂😂😂“When you can’t beat them, join them” pic.twitter.com/SnX3KN57o8— Nicolas Fränkel 🇪🇺🇺🇦🇬🇪 (@nicolas_frankel) March 22, 2023 Of course, at some point, a fanboy hijacked the thread and claimed the so-called superiority of Gradle.

Nicolas Fränkel
Jan 30, 2022 maven plugin pom

The Flatten Maven plugin

One of the Apache Maven committers recently wrote about their plans for Maven 5.

Nicolas Fränkel
Oct 10, 2021 maven build performance maven daemon docker buildkit

Faster Maven builds in Docker

Last week, I described different techniques to fasten your Maven builds. Today, I’d like to widen the scope and do the same for Maven builds inside Docker. Between each run, we change the source code by adding a single blank line; between each section, we remove all built images, including the intermediate ones that are the results of the multi-stage build. The idea is to avoid reusing a previously built image. Baseline To compute a helpful baseline, we need a sample project.

Nicolas Fränkel
Oct 3, 2021 maven build performance maven daemon surefire

Faster Maven builds

Builds require a few properties, chief among them reproducibility. I would consider speed to be low on the order of priorities. However, it’s also one of the most limiting factors to your release cycle: if your build takes T, you cannot release faster than each T. Hence, you’ll probably want to speed up your builds after you’ve reached a certain maturity level to enable more frequent releases.

Nicolas Fränkel
Jan 10, 2021 jar assembly shade spring boot maven

Creating self-contained executable JARs

When your application goes beyond a dozen of lines of code, you should probably split the code into multiple classes. At this point, the question is how to distribute them. In Java, the classical format is the Java ARchive, better known as the JAR. But real-world applications probably depend on other JARs. This post aims to describe ways to create self-contained executable JARs, also known as uber-JARs or fat JARs. What is an executable JAR? A JAR is just a collection of class files.

Nicolas Fränkel
Dec 20, 2020 maven logging log4j2 slf4j spring boot

Feedback on the Log4J2 hack in Spring Boot

Last week, I wrote a post that described how to hack the Maven dependency resolution system. I admit it was a dirty hack, it’s even in the post name. But I got it wrong. Thanks Stéphane Nicoll for pointing it out: "It boils down to excluding the spring-boot-starter-logging in every Spring Boot starter"Since you've put every in bold, I assume you meant it. That's actually wrong and not what the documentation states.Here is an example: https://t.

Nicolas Fränkel
Dec 13, 2020 maven hack logging log4j2 slf4j spring boot

A dirty hack to ease the usage of Log4J2 in Spring Boot

Logging is one of the fundamental components of any application which runs in production. Yet, between performance and logging in critical environments, I’d favor the former. For that reason, modern logging frameworks should implement at least two requirements: Async appenders: the write operation shouldn’t be blocking the execution of the programLazy computation: the framework doesn’t run expensive computations until they are needed - or never if that’s the case.

Nicolas Fränkel
Aug 30, 2020 github actions continuous integration maven release management

GitHub Actions and Maven releases

I like GitLab a lot. Yet, there’s no denying that GitHub has become the de facto standard to host Open Source projects. With GitHub Actions, it’s now possible to implement entire Continuous Integration pipelines without leaving GitHub. In this post, I’d like to highlight how to release Maven artifacts using GitHub Actions. Maven prerequisites Before creating the CI pipeline - and running it, it’s necessary to configure the underlying Maven project.

Nicolas Fränkel
Mar 10, 2019 spring devtools maven jib intellij idea tip

Spring DevTools with Jib and IntelliJ IDEA

I’ve been recently developing a Spring Boot application, and to speed up my development speed, I added Developer Tools as a dependency. By default, classes loaded in the HotSpot JVM can be updated only if the later runs in debug mode, and only for changes regarding method implementation. This means adding an attribute to an class requires a full restart. DevTools is an improvement over that.

Nicolas Fränkel
Apr 15, 2018 spring boot maven software architecture

Multiple modules in Spring Boot apps

Spring Boot is a huge success, perhaps even more so than its inceptors hoped for. There is a lot of documentation, blog posts, and presentations on Spring Boot. However, most of them are aimed toward a feature, like monitoring or configuring. Few - if any of them, describe real-world practices. In this post, I’d like to highlight how to design a Spring Boot having multiple modules.

Nicolas Fränkel
Oct 8, 2017 maven build docker maintenance

Truly immutable builds

It sometimes happen that after a few years, an app is stable enough that it gets into hibernating mode. Though it’s used and useful, there are no changes to it and it happily runs its life. Then, after a while, someone decides to add some new features again. Apart from simple things such as locating the sources, one of the most important thing is to be able to build the app. Though it may seem trivial, there are some things to think about.

Nicolas Fränkel
Apr 12, 2015 build maven polyglot

Polyglot everywhere - part 1

This is the era of polyglot! Proponents of this practice spread the word that you’ve to choose the language best adapted to the problem at hand. And with a single team dedicated to a microservice, this might make sense.

Nicolas Fränkel
Mar 29, 2015 bintray maven

Better developer-to-developer collaboration with Bintray

I recently got interested in Spring Social, and as part of my learning path, I tried to integrate their Github module which is still in Incubator mode. Unfortunately, this module seems to have been left behind, and its dependency on the core module uses an old version of it. And since I use the latest version of this core, Maven resolves one version to put in the WEB-INF/lib folder of the WAR package. Unfortunately, it doesn’t work so well at runtime.

Nicolas Fränkel
Jan 4, 2015 configuration maven spring

Spring profiles or Maven profiles?

Deploying on different environments requires configuration, e.g. database URL(s) must be set on each dedicated environment. In most - if not all Java applications, this is achieved through a .properties file, loaded through the appropriately-named Properties class. During development, there’s no reason not to use the same configuration system, e.g. to use an embedded h2 database instead of the production one.

Nicolas Fränkel
Jul 6, 2014 maven spring

Easier Spring version management

Earlier on, Spring migrated from a monolithic approach - the whole framework, to a modular one - bean, context, test, etc. so that one could decide to use only the required modules. This modularity came at a cost, however: in the Maven build configuration (or the Gradle one for that matter), one had to specify the version for each used module.

Nicolas Fränkel
Jun 1, 2014 android genymotion gradle maven scala

Scala on Android and stuff: lessons learned

I play Role-Playing since I’m eleven, and me and my posse still play once or twice a year. Recently, they decided to play Earthdawn again, a game we didn’t play since more than 15 years! That triggered my desire to create an application to roll all those strangely-shaped dice. And to combine the useful with the pleasant, I decided to use technologies I’m not really familiar with: the Scala language, the Android platform and the Gradle build system.

Nicolas Fränkel
Jul 21, 2013 ant build gradle maven

Stop the f... about Gradle

Stop the f… about #Spring & #Hibernate migrating to #Gradle. Repeat after me: "my project do NOT have the same requirements" #Maven— Nicolas Fränkel 🇪🇺🇺🇦🇬🇪 (@nicolas_frankel) July 16, 2013 This was my week’s hate, and I take full responsibility for every character in it. While that may seem like a troll, Twitter is not really the place to have a good-natured debate with factual arguments, so here is the follow up.

Nicolas Fränkel
Jul 7, 2013 maven

Maven between different environments

As a consultant, I find myself in different environments in need of different configurations. One such configuration is about the Maven settings file. This file is very important, for it governs such things as servers, mirrors and proxies. When you have a laptop, switching from customer configuration to home configuration and vice versa when you change place quickly becomes a bore. When you have to handle more than one customer, it escalates a nightmarish and tangled configuration mess.

Nicolas Fränkel
Aug 25, 2012 maven test

Re-use your test classes across different projects

Sometimes, you need to reuse your test classes across different projects. These are two use-cases that I know of: Utility classes that create relevant domain objects used in different modulesDatabase test classes (ans resources) that need to be run in the persistence project as well as the integration test project Since I’ve seen more than my share of misuses, this article aim to provide an elegant solution once and for all.

Nicolas Fränkel
Jul 8, 2012 css maven

Empower your CSS in your Maven build

People who know me also know I’ve interest in the GUI: that means I’ve sometimes to get my hands dirty and dig deep into stylesheets (even though I’ve no graphical skill whatsoever). When it happens, I’ve always questions regarding how to best factorize styles. In this regard, the different CSS versions are lacking, because they were not meant to be managed by engineers.

Nicolas Fränkel
Apr 29, 2012 eclipse maven wtp

Why Eclipse WTP doesn't publish libraries when using m2e

Lately, I noticed my libraries weren’t published to Tomcat when I used a Maven project in Eclipse, even though it was standard war packaging. Since I mostly use Vaadin, I didn’t care much, I published the single vaadin-x.y.z.jar to the deployed WEB-INF/lib manually and I was done with it. Then, I realized it happened on two different instances of Eclipse and for the writing of Develop Vaadin apps with Scala, I used 3 different libraries, so I wanted to correct the problem.

Nicolas Fränkel
Nov 13, 2011 maven review

Apache Maven 3 Cookbook

This review is about Apache Maven 3 Cookbook by Srirangan from Packt Publishing.

Nicolas Fränkel
Oct 9, 2011 maven

Maven doesn't suck, your POM does

Maven bashing is an all-time favorite: there are plenty of articles telling how Maven downloads the whole Internet, or how POMs are bloated and so on. While I agree that Maven could be perfected, I’m also aware that some (if not most) of its shortcomings are not intrinsic but are caused by (very) bad configuration. Worse, even if used correctly in your projects, problems sometimes come from third-party dependencies! You do not believe me?

Nicolas Fränkel
Oct 4, 2011 maven

Free eBook: Apache Maven 3 Cookbook

Dear readers, In order to celebrate the release of Apache Maven 3 Cookbook, Packt Publishing contacted me in order to hold a contest to grab a free copy of the eBook! To be frank, I haven’t a clue toward organizing a contest so the first three who send me a mail at nicolas at frankel dot ch with the subject 'Apache Maven 3 Cookbook' will be sent the eBook for free. Don’t waste your time: on your mark, ready, go! And thanks Packt for these gifts.

Nicolas Fränkel
Sep 25, 2011 eclipse m2eclipse maven

Migrating from m2eclipse to m2e

Since Indigo, the Maven Ecliple plugin formerly known as m2eclipse became part of Eclipse release . The name of the plugin also changed from m2eclipse to m2e. This was not the sole change, however: the number of tabs on the POM has shrinked drastically, and the features as well. This will probably be the subject of a later post since I feel quite cheated by the upgrade.

Nicolas Fränkel
Sep 11, 2011 m2eclipse maven

Better Maven integration leads to unforeseen consequences (bugs)

This week, I was faced with what seemed an near-insuperable problem. I was called by one of my dev: as soon as he upgraded his Eclipse (or more precisely, our own already-configured Eclipse), he couldn’t deploy to Tomcat through WTP. Here are the steps I took to resolve the problem and more general thoughts about upgrading and tooling. The log displayed a ClassNotFoundException, one involving Spring. So, the first step is to look under the hood.

Nicolas Fränkel
Sep 4, 2011 dry maven

Skinny WAR done right

In a previous post, I wrote about how to create skinny WAR with Maven the DRY way: it was not the DRYier way to do it, as was demonstrated to me this week by my colleague Olivier Chapiteau (credit where credit is due). His solution is far more elegant; it is reproduced in the post for reference’s sake.

Nicolas Fränkel
Jun 19, 2011 jboss maven repo1

Maven repositories in anger!

Every build systems worth his salt acknowledges Maven dependencies repository. Even those vehemently opposed to the way Maven does things, like Gradle, still uses repo1. Wait, repo1? If there was only repo1. But nowadays, every project publishes its artifacts in its own repository. For some providers, like SpringSource and JBoss, I think it may be for marketing reasons.

Nicolas Fränkel
Jan 24, 2011 maven scala vaadin

Mixing Vaadin and Scala (with a touch of Maven)

People who are familiar with my articles know that I’m interested in Vaadin and also more recently in Scala since both can increase your productivity. Thus it is only natural that I tried to embed the best of both worlds, so to speak, as an experience. As an added challenge, I also tried to add Maven to the mix. It wasn’t as successful as I had wished, but the conclusions are interesting.

Nicolas Fränkel
Jul 26, 2010 maven

Managing POM versions

This article won’t be long but can be a lifesaver. If you use Maven, how many times did you need to manually update POM versions in an entire modules hierarchy? For me, the answer is: too many. When you project grows to include many Maven modules, releasing a new version can be a nightmare.

Nicolas Fränkel
Apr 21, 2010 dry maven

DRY and skinny war

In this article, I will show you how the DRY principle can be applied when using the skinny war configuration of the maven-war-plugin. While packaging an EAR, it is sometimes suitable that all libraries of the different WARs be contained not in their respective WEB-INF/lib folders but at the EAR level so they are usable by all WARs. Some organizations even enforce this rule so that this is not merely desiarable but mandatory. Using Maven, nothing could be simpler.

Nicolas Fränkel
Feb 3, 2010 book maven

Maven The complete reference

This review is about Sonatype’s Maven: The complete reference by Tim O’Brien, John Casey, Brian Fox, Jason Van Zyl, Eric Redmond and Larry Shatzer. Disclaimer: I learned Maven from Sonatype’s site 3 years ago. I found it was a great tool to learn Maven. Now that I have a little more experience in the tool, I tried to write this review in an objective manner.

Nicolas Fränkel
Dec 5, 2009 effective maven

Apache Maven 2 Effective implementation

This review is about Packt’s Apache Maven 2 Effective Implementation by Maria Odea Ching and Brett Porter. Facts 12 chapters, 436 pages, 39.99$This book is intended for people that already have a good experience of Maven. The 'About Maven' part is as small as it can get, it is the opposite of what could be 'Maven for Dummies', where you learn to type mvn something.

Nicolas Fränkel
Aug 8, 2009 eclemma eclipse emma ide important m2eclipse maven necessary plugins spring testng top

Top Eclipse plugins I wouldn't go without

Using an IDE to develop today is necessary but any IDE worth his salt can be enhanced with additional features. NetBeans, IntelliJ IDEA and Eclipse have this kind of mechanism. In this article, I will mention the plugins I couldn’t develop without in Eclipse and for each one advocate for it. m2eclipse Maven is my build tool of choice since about 2 years. It adds some very nice features comparing to Ant, mainly the dependencies management, inheritance and variable filtering.

Nicolas Fränkel
A Java geek © 2008-2026
v. bc04c88300c3ec997ce8470fbff5395dc9e518b1/13264050981
Latest Posts