2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
In a Maven project,pom.xml
The file is the configuration file of the Project Object Model (POM), which defines the project's dependencies, plugins, build configuration, etc. The following ispom.xml
Some important tags in the file and their functions:
<modelVersion>
:
4.0.0
。<modelVersion>4.0.0</modelVersion>
<groupId>
:
<groupId>com.example</groupId>
<artifactId>
:
<artifactId>my-project</artifactId>
<version>
:
<version>1.0.0</version>
<packaging>
:
jar
、war
、pom
etc. The default isjar
。<packaging>jar</packaging>
<name>
:
<name>My Project</name>
<description>
:
<description>This is a sample project</description>
<url>
:
<url>http://www.example.com</url>
<dependencies>
:
<dependency>
Label package.<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.3.8</version>
</dependency>
</dependencies>
<dependencyManagement>
:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.3.8</version>
</dependency>
</dependencies>
</dependencyManagement>
<repositories>
:
<repositories>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
<build>
:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<profiles>
:
<profiles>
<profile>
<id>dev</id>
<properties>
<env>development</env>
</properties>
</profile>
</profiles>
These tags constitute pom.xml
The basic framework for configuring and managing Maven projects. Each tag has a specific role and helps developers define various aspects of the project.