Sobes.tech
Junior

Tell us about the structure of the POM file in the Maven package manager.

sobes.tech AI

Answer from AI

<!-- Basic POM file -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <!-- POM model version. Always 4.0.0 for Maven 2/3 -->
    <modelVersion>4.0.0</modelVersion>

    <!-- Project coordinates -->
    <groupId>com.example</groupId> <!-- Group (organization) identifier -->
    <artifactId>my-project</artifactId> <!-- Artifact (project) identifier -->
    <version>1.0.0-SNAPSHOT</version> <!-- Project version (SNAPSHOT - in development) -->
    <packaging>jar</packaging> <!-- Artifact packaging type (jar, war, pom, ear, etc.) -->

    <!-- Project description -->
    <name>My Amazing Project</name> <!-- Readable project name -->
    <description>A simple example Maven project.</description> <!-- Detailed description -->
    <url>http://www.example.com/my-project</url> <!-- Project URL -->

    <!-- Project properties -->
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- Source encoding -->
        <java.version>11</java.version> <!-- Java version -->
    </properties>

    <!-- Dependency management -->
    <dependencies>
        <!-- Example dependency -->
        <dependency>
            <groupId>junit</groupId> <!-- Dependency group -->
            <artifactId>junit</artifactId> <!-- Dependency artifact -->
            <version>4.13.2</version> <!-- Dependency version -->
            <scope>test</scope> <!-- Scope (compile, test, runtime, provided, system, import) -->
        </dependency>
    </dependencies>

    <!-- Build management -->
    <build>
        <plugins>
            <!-- Example plugin for Java compilation -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source> <!-- Use Java version property -->
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <!-- Repository management -->
    <repositories>
        <repository>
            <id>central</id>
            <url>https://repo.maven.apache.org/maven2</url>
        </repository>
    </repositories>

    <!-- Profile management -->
    <profiles>
        <profile>
            <id>dev</id> <!-- Profile ID -->
            <!-- Special settings for "dev" profile -->
        </profile>
    </profiles>

</project>
Tell us about the structure of the POM file in the… - sobes.tech