Skip to main content

Posts

Showing posts with the label Maven

Improving the execution time of CI pipelines

Executing a large number of tests, especially integration tests, takes a lot of time. For instance, the pipeline of one of our projects for each Pull Request previously took nearly 30 minutes, including over 1 thousand test cases. This article guides you through several good techniques that we have discovered and applied to improve the time-consuming process. Parallel stages Analyze the current phases in your pipeline and categorize them in parallel. For example, we can separate the build and verify code of Node.js and Maven modules simultaneously in our Jenkins pipelines. Please mind using the setting failFast whether you want to abort the pipeline immediately. Read more: Parallel stages with Declarative Pipeline 1.2 (jenkins.io) Parallel test execution If you use Maven, t he plugin maven-failsafe-plugin is used to execute integration tests during phases integration-test and verify  the build lifecycle. It allows us to execute tests in parallel. There are many settings related to p

Creating a Chatbot with RiveScript in Java

Motivation "Artificial Intelligence (AI) is considered a major innovation that could disrupt many things. Some people even compare it to the Internet. A large investor firm predicted that some AI startups could become the next Apple, Google or Amazon within five years"   - Prof. John Vu, Carnegie Mellon University. Using chatbots to support our daily tasks is super useful and interesting. In fact, "Jenkins CI, Jira Cloud, and Bitbucket" have been becoming must-have apps in Slack of my team these days. There are some existing approaches for chatbots including pattern matching, algorithms, and neutral networks. RiveScript is a scripting language using "pattern matching" as a simple and powerful approach for building up a Chabot. Architecture Actually, it was flexible to choose a programming language for the used Rivescript interpreter like Java, Go, Javascript, Python, and Perl. I went with Java. Used Technologies and Tools Oracle JDK 1.8

Using Drools to Dynamically Manipulate Metadata of JSF Components

The post is just an approach to change metadata (e.g maxlength, required, etc) of JSF components (e.g. inputText, selectOneMenue, etc) by Drools. Project structure Tools being used Java version 1.8.0_131 Apache Maven 3.5.0 Apache Tomcat 8.0.16 Don't forget to configure your confidential information on  these following files: pom.xml, settings.xml (Maven) and tomcat-users.xml (Tomcat). For example: Source code https://github.com/vnnvanhuong/java_lab/tree/master/jsfdrools

Building an App for Removing Multiple Slack's Files

You're a developer. What do you do in your spare time? One of my most excited task for sharpening my skills is starting build a pet project. Motivation Slack is cool! It's free. It supports for team collaboration very well. However, my team only has storage limits due to a free account. We got a warning message as below: Your file was uploaded — it’s safe and sound in Slack. Unfortunately your team doesn’t have any storage space left. To get more space, you can upgrade to a paid account or delete some of your older files. Since my team plan of upgrading to a paid account is still up in the air, I intended to go with "deleting some of our older files" first. (But we will, Slack. You are great!) Play Around I got started by googling keyword "remove slack files". Here it is: https://get.slack.help/hc/en-us/articles/218159688-Delete-shared-files Uh huh! But I only could delete one file at a time . We're afraid it's not possible t

The HelloWorld example of JSF 2.2 with Myfaces

I just did by myself create a very simple app "HelloWorld" of JSF 2.2 with a concrete implementation Myfaces that we can use it later on for our further JSF trying out. I attached the source code link at the end part. Just follow these steps below: 1. Create a Maven project in Eclipse (Kepler) with a simple Java web application archetype "maven-archetype-webapp". Maven should be the best choice for managing the dependencies , so far. JSF is a web framework that is the reason why I chose the mentioned archetype for my example. 2. Import dependencies for JSF implementation - Myfaces (v2.2.10) into file pom.xml . The following code that is easy to find from  http://mvnrepository.com/  with key words "myfaces". <dependency> <groupId>org.apache.myfaces.core</groupId> <artifactId>myfaces-api</artifactId> <version>2.2.10</version> </dependency> <dependency> <groupId>org.apache.myfaces.core<

Tip for resolving the compile errors when importing a Maven project in Eclipse

Sometimes, I import a existing Maven project into Eclipse and I get some compile errors related to "pom.xml", "facet version of Web", and  so on. It was really frustrating me because I even cleaned, built and updated the project many times but the errors still occurred. I accidentally found the following steps to resolve this issue but honestly I still don't know why. Step 1 : Delete the project that met the compile errors in Eclipse, but don't delete it on disk. Step 2 : Open the project (by Windows Explorer if you use Windows) and remove  file/folder ".classpath", ".settings" and ".project" . Step 3 : Import the project back into Eclipse. ---^0^--- Maven is a build automation tool used primarily for Java projects. Eclipse is an integrated development environment (IDE).

Managing JAR files with Apache Maven

Apache Maven (Maven) is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information. Why Maven? Let’s learn about the Maven’s history here https://maven.apache.org/background/history-of-maven.html to understand why Maven is created. There are a lot of useful things that we should use Maven. In my opinion, the most important thing is that Maven solves the problems with managing jar files. It centralizes these files in one place and it is easy to use by declaring dependencies in a xml file (pom.xml).  Using Maven to manage JAR files Firstly, I would like to give you an example about using some JAR files without Maven.  In my project, I need some JAR files such as SNMP4J.jar, jta26.jar, jgraphx.jar, etc… so I had to search them on the Internet with visiting a lot of websites, download and add these files into my project.