Standard Directory Layout (Apache Maven)

Zo stránky Informatika
Prejsť na navigáciu Prejsť na vyhľadávanie

Nastavenie

If you follow the directory structure, you do not need to specify the directories of your source code, test code, resource files, etc. in your POM file. [1]

Štruktúra

Rýchly náhľad

- src
-- main
----- java
----- resources
----- webapp
- test
----- java
----- resources
- target

Komplexný náhľad

|-- pom.xml
`-- src
    |-- main
    |   `-- java
    |   |   `-- com
    |   |       `-- mycompany
    |   |           `-- app
    |   |               `-- App.java
    |   `-- sql, groovy, ...
    |   `-- resources
    |       `-- META-INF
    |           `-- application.properties
    |-- test
    |   `-- java
    |   |   `-- com
    |   |       `-- mycompany
    |   |           `-- app
    |   |               `-- AppTest.java
    |   `-- resources
    |       `-- test.properties
    `-- target
        `-- classes
            `-- com
                `-- mycompany
                      `-- app
                        `-- App.class

Project home

Contains the pom.xml and all subdirectories.

src

Root directory of source code and test code.

src/main

Root directory for source code related to the application itself, not test code.

src/test

Directory contains the test source code.

src/main/java

Obsahuje kompilovatelné .java soubory

Contains the Java code for the application itself.

Contains the deliverable Java sourcecode for the project.

src/main/resources

Obsahuje další soubory, například konfigurační XML , (? HTML šablóny) atď.

Contains the deliverable resources for the project, such as property files.

src/test/java

Contains Java code for the tests.

Contains the testing Java sourcecode (JUnit or TestNG test cases, for example) for the project.

src/test/resources

Contains resources necessary for testing.

Obsahuje konfigurační soubory pro testy.

target

Created by Maven. It contains all the compiled classes, JAR files etc.

When executing the mvn clean command, Maven would clean the target directory.

webapp

Directory contains Java web application, if the project is a web application.

The webapp directory is the root directory of the web application. The webapp directory contains the WEB-INF directory.

Referencie

  1. Maven – Introduction to the Standard Directory Layout. Maven – Welcome to Apache Maven [online]. Dostupné z: https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html