Maven

Automatically update documentation with Github Actions

In some of my projects, I like to provide an accurate documentation. Which means that I want to have examples and documentation up to date. So, when I'm updating a library or a service I'm using in my code, I need to manually find and replace all the text to reflect the changes. This post describes how you can do this automatically using Github Actions, Maven and Dependabot.
2023-01-12
2023-10-23
6 min read
Featured Image

Elasticsearch real integration tests with security enabled

In a recent post we have seen how to create real integration tests. Those tests launch a real elasticsearch cluster, then run some tests you write with JUnit or your favorite test framework then stop the cluster. But sometimes, you may want to add existing plugins in your integration test cluster. For example, you might want to use X-Pack to bring fantastic features such as: Security Alerting Monitoring Graph Reporting Let’s see how you can do that with Maven and Ant again…
2016-08-03
2016-10-21
8 min read

Elasticsearch real integration tests

Integration tests… How do you run them? Often, you are tempted to run services you want to test from JUnit for example. In elasticsearch, you can extend ESIntegTestCase class which will start a cluster of a given number of nodes. public class BanoPluginIntegrationTest extends ESIntegTestCase { public void testPluginIsLoaded() throws Exception { // Your code here } } But to be honest, the test you are running does not guarantee that you will have the same result in production.
2016-07-29
2016-10-18
13 min read

Creating a plugin for elasticsearch 5.0 using Maven

Elasticsearch 5.0 switched to Gradle in October 2015. You can obviously write a plugin using Gradle if you wish and you could benefit from all the goodies elasticsearch team wrote when it comes to integration tests and so on. My colleague, Alexander Reelsen aka Spinscale on Twitter, wrote a super nice template if you wish to create an Ingest plugin for 5.0. Hey! Wait! You wrote Ingest? What is that? Ingest is a new feature coming in elasticsearch 5.
2016-07-27
2016-10-16
5 min read

Using Log4J2 with Hibernate 4

I was trying to use Hibernate 4.3.8.Final with Log4J2 and I spent some hours to find why Hibernate was not using Log4J2 though it was declared in my pom.xml file. Actually, I hit issue JBLOGGING-107. The workaround is simply to add a more recent jboss-logging dependency than the one shipped by default with Hibernate 4.3.8.Final. <dependency> <groupId>org.jboss.logging</groupId> <artifactId>jboss-logging</artifactId> <version>3.2.1.Final</version> </dependency>
2015-03-05
1 min read

La factory Spring pour Elasticsearch est sortie !

Et voilà, la première release de la factory spring vient d’être faite. Vous pouvez donc maintenant l’utiliser dans vos projets Maven : <dependency> <groupId>fr.pilato.spring</groupId> <artifactId>spring-elasticsearch</artifactId> <version>0.0.1</version> </dependency> Le code source est disponible sur github.

Une factory Spring pour Elasticsearch

Le besoin Il existe dans Hibernate une fonctionnalité que j’aime beaucoup : la mise à jour automatique du schéma de la base en fonction des entités manipulées. Mon besoin est de faire quasiment la même chose avec Elasticsearch. C’est à dire que je souhaite pouvoir appliquer un mapping pour un type donné à chaque fois que je démarre mon projet (en l’occurrence une webapp). En me basant sur le projet développé par Erez Mazor, j’ai donc développé unefactory Spring visant à démarrer des clients (voire des noeuds) Elasticsearch.

Quel client Java pour elasticsearch ?

Il existe deux modes d’accès à elasticsearch en Java : Inscrire un noeud client dans le cluster elasticsearch Utiliser un client “simple” Noeud client dans un cluster elasticsearch L’idée de cette méthode est de fabriquer un noeud elasticsearch (node) qui démarre avec les mêmes caractéristiques qu’un noeud d’indexation et de recherche sauf qu’on lui précise qu’il n’hébergera pas de données. Pour cela, on utilise la propriété suivante : node.data=false Elle indique que le noeud que nous démarrons n’hébergera pas de données.
2012-02-13
3 min read

Mon premier plugin elasticsearch : RSS River

Il existe dans elasticsearch la notion de river (rivière) qui comme son nom le laisse supposer permet de voir s’écouler des données depuis une source jusqu’à elasticsearch. Au fur et à mesure que les données arrivent, la rivière les transporte et les envoie à l’indexation dans elasticsearch. En standard, il existe 4 rivières : CouchDB qui permet d’indexer toutes les nouveautés d’une base CouchDB. Voir aussi cet article à ce propos. RabbitMQ qui permet de récupérer des documents dans une queue de traitement asynchrone (genre JMS) Twitter qui permet d’indexer votre flux de messages twitter par exemple Wikipedia qui permet d’indexer toutes les nouveautés de l’encyclopédie au fur et à mesure de leurs publications Premiers pas J’ai commencé par bidouiller un peu la rivière CouchDB pour y apporter quelques fonctionnalités dont mes collègues avaient besoin :
2011-09-14
4 min read
Featured Image

Utiliser Jetty 7 avec Maven

Jetty peut être très utile aux projets Maven, notamment dans la phase de tests d’intégration. Il faut souvent déployer l’application sur un serveur type JBoss puis lancer les tests. Avec Jetty, on dispose alors d’un conteneur léger qui permet de disposer des fonctionnalités essentielles d’un conteneur (webapp, datasource, …). Problème : avec la version 7 de Jetty, il faut gérer l’authentification. Sinon, on obtient une erreur du type : java.lang.IllegalStateException: No LoginService for org.eclipse.jetty.security.authentication.BasicAuthenticator@4095c5ec in ConstraintSecurityHandler@28f52a14@ J’ai trouvé la solution à ce problème sur le blog de Max Berger.
2010-02-25
1 min read

Problème Jetty / Maven sous Windows

Lorsqu’on souhaite lancer une WebApp avec le plugin Jetty sous Maven 2 depuis un PC sous windows on obtient une erreur référencée sous JIRA #JETTY-1063 : java.net.URISyntaxException: Illegal character in path at index 18: file:/C:/Documents and Settings/USER/.m2/repository/org/mortbay/jetty/jetty-maven-plugin/7.0.0.1beta2/jetty-maven-plugin-7.0.0.1beta2.jar Ce problème n’est résolu que sous Maven 3. Pour ceux qui souhaitent rester sous Maven 2 (Maven 3 est encore en version alpha), il faut modifier l’emplacement de la repository pour éviter le souci du caractère ESPACE présent dans le chemin C:\Documents and settings\USER\.
2010-02-24
1 min read

Publication de documentation fonctionnelle avec Maven

Voici une astuce permettant de laisser les analystes ou concepteurs utiliser leurs logiciels habituels de documentation (oOo ou Word), tout en permettant de publier automatiquement avec la génération du site un document PDF lisible par tous.
2010-02-23
2 min read