LayoutTitle

Hoverable Dropdown

Showing posts with label project object model. Show all posts
Showing posts with label project object model. Show all posts

Thursday, March 7, 2019

What is the difference between normal Java Project and Maven Project?



Here are the few points on the differences on normal Java & Maven Project

1.   Normal Project & Maven Project structure vary, see below. Observations are here you won't see the Maven Life cycle and also POM doesn't preset. Moreover you can run the java class by right clicking as shown below

      
Normal Java Project  & Its folder structure
Maven Java Project & Its folder structure

      NOTE: Maven project shows POM file and also Maven Life cycle to perform the desired action and also you can run the Java class by setting the run configuration under Maven project

2.  Maven Project only will have Project Object Model (POM) file
3.  Maven is a software project management and comprehension tool hence it will manage a project's build, reporting and documentation automatically from a central piece of information.
4.  Maven itself has life-cycle which includes clean, validate, compile, test, package, verify, install, site and deploy of your project created. These life-cycle helps you to perform relevant activities automatically unlike you do all these activities with great difficultly manually in Normal Java projects
5.  While creating Maven one should provide group id, artifact id & version for your project. These information helps you in identifying your project uniquely and helps to store your projects in version control tools
6.  In Normal Project, if you want to work on any third party / API applications then you have to associate those jar files and associate/configure those jar files to your project manually, whereas in Maven project provide the third party/API applications dependency in POM file and then click on Maven install then automatically those respective libraries automatically to your project.

Example: Selenium java dependency, should add the below one in your POM file and run Maven install to have them to your project

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
<scope>test</scope>
</dependency>


Example: Cucumber maven dependency

<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>

Steps involved in creating a Maven project

1.       Select File>>New >> Project

2.       Select Maven and click Next on New Project Window

3.       Provide inputs against
a.       Group ID
b.      Artifact ID
c.       Version and click Next

4.       Provide inputs to
a.       Project Name
b.      Project Location and click Finish

5.       Finally, a Maven project will be created with a POM file. 

Note: Here the project folder will be automatically created along with the default details related to Maven and the project in the POM file.

Now it is the phase where you add the 3rd party applications/API related Maven dependency in the POM file and just click on the install under Maven Life Cycle to have the respective libraries to your project.