You can easily tell Maven to include the version of the artifact and its Git/SVN/… revision in the JAR manifest file and then access that information at runtime via getClass().getPackage.getImplementationVersion(). (All credit goes to Markus Krüger and other colleagues.)
Tag Archives: Maven
Separating Integration and Unit Tests with Maven, Sonar, Failsafe, and JaCoCo
Goal: Execute the slow integration tests separately from unit tests and show as much information about them as possible in Sonar. The first part – executing IT and UT separately – is achieved by using the maven-failsafe-plugin and by naming the integration tests *IT (so that the unit test running surefire-maven-plugin will ignore them whileContinue reading “Separating Integration and Unit Tests with Maven, Sonar, Failsafe, and JaCoCo”
Visualize Maven Project Dependencies with dependency:tree and Dot Diagram Output
The dependency:tree goal of the Maven plugin dependency supports various graphical outputs from the version 2.4 up. This is how you would create a diagram showing all dependencies in the com.example group in the dot format: (The output is just a text file with the extension Graphviz gv.) To actually produce an image from theContinue reading “Visualize Maven Project Dependencies with dependency:tree and Dot Diagram Output”
Most interesting links of December
Recommended Readings The Netflix Chaos Monkey – how to test your preparedness for dealing with a system failure so that you won’t experience nasty wakeup when something really fails in Sunday 3 am? Release a wild, armed monkey into your datacenter. Watch carefuly what happens as it randoly kills your instances. This is exactly whatContinue reading “Most interesting links of December”
Hacking A Maven Dependency with Javassist to Fix It
Have you ever wondered what to do when needing “just a small change” to a third-part library your project depended on? This post describes how to use Maven and Javassist to take a dependency of your project, instrument it to modify its behavior, re-pack it, and release it as an artifact with a different nameContinue reading “Hacking A Maven Dependency with Javassist to Fix It”
Tools for Renaming the Package of a Dependency with Maven
If you need to rename the Java package of a 3rd party library, e.g. to include it directly in your project while avoiding possible conflicts, you can use one of the following Maven plugins (and they may be more) in the package lifecycle phase: Uberize plugin (latest – org.fusesource.mvnplugins:maven-uberize-plugin:1.20) – originally inspired by the ShadeContinue reading “Tools for Renaming the Package of a Dependency with Maven”
Note to Self: Running GroovyConsole with a Maven Project’s Classpath
It’s pretty useful to have the ability to eperiment interactively with some API using the (desktop) Groovy Console. If the API is in a Maven project, just add dependency on Groovy to your pom.xml: And execute the console from the project’s folder using the exec plugin: Enjoy.
Using Ivy with pom.xml
It’s possible to use Apache Ivy with dependencies defined in pom.xml instead of its native ivy.xml but you will need to apply some workarounds and you’re loosing access to some functionality that you might (or might not) need. The problem is that in a POM you can provide only a subset of settings available inContinue reading “Using Ivy with pom.xml”
Most interesting links of November
This month has been quite interesting, among others I ‘ve picked up several blogs by Adam Bien. I really like his brief, practical and insightful posts 🙂 Java, Jave EE, architecture etc. EJB 3.1 + Hessian = (Almost) Perfect Binary Remoting – “With hessian it is very easy to expose existing Java-interfaces with almost noContinue reading “Most interesting links of November”
Most interesting links of October
Few of my favourite themes this month – TDD, performance, build tools/Maven. Plus a usefel JS library, news from the Java community x Oracle world etc. About dying JCP and too silent Oracle (or mostly silent) – a summary of the latest issues and hot topics in the Java community that cause lot of rumorContinue reading “Most interesting links of October”