Posts

Showing posts with the label Maven

Building Project using Plugins, Lifecycle in Maven (Part-3)

Image
How can we build a project in Maven?  It can be done either by executing maven plugins or maven life cycle phases or a combination of both maven plugins and maven life cycle. Maven Plugin  ( available at http://repo.maven.apache.org/maven2/org/apache/maven/plugins/ ) All the work in Maven is performed by plugins. Be it Project creation using archetype(refer post1 ), project packaging,  project build etc., Maven created plugins that can carry out these tasks.  Below are the list of tasks for which the maven plugins are already available. Build Activities:  clean,  deploy etc.,  Test activities :  compiling and running test cases, code coverage, etc., Web Applications : Deploying and running web applications  Reporting tasks :  changelog, javadoc, project reports etc., How to use a plugin? A plugin usage is very simple. By executing the below command(for eg.) in project root folder, we can compile all the sources(ma...

What is POM, Parent, Dependencies?(Part-2)

Image
POM.xml POM.xml file is what maven refers to for the  project information and build configuration information.  Project information typically includes Project version, description, artifacts, etc., where as build configuration includes dependencies(JARs), goals, plugins, repositories, etc., So, a general POM file contains all these details.  Since, this post is continuation of the maven series we have started earlier. I am referring to the POM(below fig.) file that we generated using spring boot archetype in the earlier post. For understanding the project creation using archetype refer to Post1 (http://javarephrased.blogspot.in/2016/02/what-is-maven-what-is-archetype-and.html) on maven.  As you see, we    didn't mention all the details (discussed earlier) in the POM file. Maven do not even force you to provide all the details.  To create a Simple POM.xml for a project, modelVersion(1), artifactId(2), groupId(3), version(4) in the below fig...

What is Maven, What is Archetype and Creating a Maven Project

Image
Issues with legacy build frameworks(ANT) Earlier with Ant, if we have to build a java project we need to put the logic for every task like compile, run in the build.xml. Though, these tasks are common across all the java projects. There is no way we can reuse. Below are some of the other pain points in Ant build framework. Writing the logic for Project folder creation Download and copy all the dependent Jars into your project Writing the logic for reusable tasks like compile, test, run What is Maven? Maven is an alternative build framework which addresses a ll the pain points mentioned above. Though its usage is not limited to build, in this post we will limit the scope to build itself. we will see how maven simplifies the above concerns.  What is Archetype? Maven maintains a template for each project type and calls this template as Archetype. These archetypes exist for almost every project type in the maven repository. There are arch...