什么是POM?
項目對象模型或POM是Maven中的基本工作單元箫津。這是一個XML文件婿崭,其中包含有關項目的信息以及Maven用于構建項目的配置詳細信息。它包含大多數(shù)項目的默認值躺枕。比如構建目錄服猪,即target;?源目錄,即src/main/java拐云;測試源目錄罢猪,即src/test/java;等等叉瘩。當執(zhí)行任務或目標時膳帕,Maven在當前目錄中查找POM。它讀取POM薇缅,獲取所需的配置信息危彩,然后執(zhí)行目標。
可以在POM中指定的一些配置是項目依賴項捅暴,可以執(zhí)行的插件或目標恬砂,構建配置文件等等。也可以指定其他信息蓬痒,例如項目版本泻骤,描述,開發(fā)人員梧奢,郵件列表等狱掂。
Super POM
Super POM是Maven的默認POM。除非明確設置亲轨,否則所有POM都會擴展Super POM趋惨,這意味著Super POM中指定的配置將由您為項目創(chuàng)建的POM繼承。您可以在Maven Core參考文檔中看到適用于Maven 3.6.3的Super POM惦蚊。
sdfsd<br>fsdfsdfsdfsdfsdfssfsdfsdfsd
<project>
? <modelVersion>4.0.0</modelVersion>
? <repositories>
? ? <repository>
? ? ? <id>central</id>
? ? ? <name>Central Repository</name>
? ? ? <url>https://repo.maven.apache.org/maven2</url>
? ? ? <layout>default</layout>
? ? ? <snapshots>
? ? ? ? <enabled>false</enabled>
? ? ? </snapshots>
? ? </repository>
? </repositories>
? <pluginRepositories>
? ? <pluginRepository>
? ? ? <id>central</id>
? ? ? <name>Central Repository</name>
? ? ? <url>https://repo.maven.apache.org/maven2</url>
? ? ? <layout>default</layout>
? ? ? <snapshots>
? ? ? ? <enabled>false</enabled>
? ? ? </snapshots>
? ? ? <releases>
? ? ? ? <updatePolicy>never</updatePolicy>
? ? ? </releases>
? ? </pluginRepository>
? </pluginRepositories>
? <build>
? ? <directory>${project.basedir}/target</directory>
? ? <outputDirectory>${project.build.directory}/classes</outputDirectory>
? ? <finalName>${project.artifactId}-${project.version}</finalName>
? ? <testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
? ? <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
? ? <scriptSourceDirectory>${project.basedir}/src/main/scripts</scriptSourceDirectory>
? ? <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
? ? <resources>
? ? ? <resource>
? ? ? ? <directory>${project.basedir}/src/main/resources</directory>
? ? ? </resource>
? ? </resources>
? ? <testResources>
? ? ? <testResource>
? ? ? ? <directory>${project.basedir}/src/test/resources</directory>
? ? ? </testResource>
? ? </testResources>
? ? <pluginManagement>
? ? ? <!-- NOTE: These plugins will be removed from future versions of the super POM -->
? ? ? <!-- They are kept for the moment as they are very unlikely to conflict with lifecycle mappings (MNG-4453) -->
? ? ? <plugins>
? ? ? ? <plugin>
? ? ? ? ? <artifactId>maven-antrun-plugin</artifactId>
? ? ? ? ? <version>1.3</version>
? ? ? ? </plugin>
? ? ? ? <plugin>
? ? ? ? ? <artifactId>maven-assembly-plugin</artifactId>
? ? ? ? ? <version>2.2-beta-5</version>
? ? ? ? </plugin>
? ? ? ? <plugin>
? ? ? ? ? <artifactId>maven-dependency-plugin</artifactId>
? ? ? ? ? <version>2.8</version>
? ? ? ? </plugin>
? ? ? ? <plugin>
? ? ? ? ? <artifactId>maven-release-plugin</artifactId>
? ? ? ? ? <version>2.5.3</version>
? ? ? ? </plugin>
? ? ? </plugins>
? ? </pluginManagement>
? </build>
? <reporting>
? ? <outputDirectory>${project.build.directory}/site</outputDirectory>
? </reporting>
? <profiles>
? ? <!-- NOTE: The release profile will be removed from future versions of the super POM -->
? ? <profile>
? ? ? <id>release-profile</id>
? ? ? <activation>
? ? ? ? <property>
? ? ? ? ? <name>performRelease</name>
? ? ? ? ? <value>true</value>
? ? ? ? </property>
? ? ? </activation>
? ? ? <build>
? ? ? ? <plugins>
? ? ? ? ? <plugin>
? ? ? ? ? ? <inherited>true</inherited>
? ? ? ? ? ? <artifactId>maven-source-plugin</artifactId>
? ? ? ? ? ? <executions>
? ? ? ? ? ? ? <execution>
? ? ? ? ? ? ? ? <id>attach-sources</id>
? ? ? ? ? ? ? ? <goals>
? ? ? ? ? ? ? ? ? <goal>jar-no-fork</goal>
? ? ? ? ? ? ? ? </goals>
? ? ? ? ? ? ? </execution>
? ? ? ? ? ? </executions>
? ? ? ? ? </plugin>
? ? ? ? ? <plugin>
? ? ? ? ? ? <inherited>true</inherited>
? ? ? ? ? ? <artifactId>maven-javadoc-plugin</artifactId>
? ? ? ? ? ? <executions>
? ? ? ? ? ? ? <execution>
? ? ? ? ? ? ? ? <id>attach-javadocs</id>
? ? ? ? ? ? ? ? <goals>
? ? ? ? ? ? ? ? ? <goal>jar</goal>
? ? ? ? ? ? ? ? </goals>
? ? ? ? ? ? ? </execution>
? ? ? ? ? ? </executions>
? ? ? ? ? </plugin>
? ? ? ? ? <plugin>
? ? ? ? ? ? <inherited>true</inherited>
? ? ? ? ? ? <artifactId>maven-deploy-plugin</artifactId>
? ? ? ? ? ? <configuration>
? ? ? ? ? ? ? <updateReleaseInfo>true</updateReleaseInfo>
? ? ? ? ? ? </configuration>
? ? ? ? ? </plugin>
? ? ? ? </plugins>
? ? ? </build>
? ? </profile>
? </profiles>
</project>