Chapter 3. Creating and Importing Projects

Let's proceed on our journey. In this chapter, we will start with the Maven project structure followed by the build architecture, then we will cover some essential concepts, and finally learn how to create simple Maven projects. The chapter is divided into the following sections:

  • The Maven project structure
  • POM (Project Object Model)
    • Maven coordinates
    • POM relationships
    • Simple POM
    • Super POM
  • The Maven project build architecture
  • Other essential concepts
    • Repository
    • Project dependencies
    • Plugins and goals
    • Site generation and reporting
  • Creating a Maven project
    • Using an archetype
    • Using no archetypes
    • Checking out a Maven project
  • Importing Maven projects

The Maven project structure

Maven, as stated in earlier chapters, follows convention over configuration. This makes us believe that there is a standard layout of the Maven project structure. Before we get into creating and playing with Maven projects, let's first understand the basic common layout of Maven projects, as follows:

Folder/Files

Description

src/main/java

This contains an application's Java source files

src/main/resources

This contains files of an application's resources such as images, sounds, templates, and so on

src/main/filters

This contains the resource's filter files

src/main/config

This contains the configuration files of the application

src/main/scripts

This has files of application-specific scripts

src/main/webapp

This has sources files for web applications

src/test/java

This contains unit test files of Java

src/test/resources

This has unit testing-specific resources used in an application

src/filters

This has files of the test-specific filter for resources

src/it

This has integration tests files (primarily for plugins )

src/assembly

This contains files of the assembly descriptors

src/site

This contains site artifacts

LICENSE.txt

This denotes the projects license

NOTICE.txt

This includes the notice and attributions that the project depends on

README.txt

This denotes the project's readme information

target

This houses all the output of the build

pom.xml

This is the project's pom file (which will be discussed in detail in the forthcoming sections)

Though the previously mentioned layout is the standard recommended convention, this can always be overridden in the project descriptor file (pom file).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.37.20