公司范围内的父pom [英] Company wide parent pom

查看:149
本文介绍了公司范围内的父pom的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以对单个父pom使用mvn deploy?这个pom.xml文件将是我所有项目的父pom.我是否可以仅部署此pom.xml文件,而不部署其他工件?

Is it possible that I use a mvn deploy for a single parent pom? This pom.xml file will be the parent pom of all my projects. Is it possible for me to deploy just this pom.xml file and no other artifact?

如果我将其用作公司范围的pom,我是否必须包含模块标签.

If i use this as my company wide pom, do i have to include the module tag.

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>onestopspot</groupId>
    <artifactId>parent</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>OneStopSpot - Parent</name>
    <description>Android application for OneStopspot</description>
    <distributionManagement>
        <repository>
            <id>confiz-repo</id>
            <url>http://10.10.10.230:8081/nexus/content/repositories/snapshots/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
     </distributionManagement>
    <dependencyManagement>
        <dependencies>
            <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>4.1.1.4</version>
        <scope>provided</scope>
        </dependency>
            <dependency>
                <groupId>com.google.android</groupId>
                <artifactId>android-test</artifactId>
                <version>2.3.3</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>3.5.1</version>
                    <configuration>
                        <sdk>
                            <platform>10</platform>
                        </sdk>
                        <undeployBeforeDeploy>true</undeployBeforeDeploy>
                    </configuration>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <modules>
        <module>api_library</module>
        <module>instrumentation</module>
    </modules>
</project>

推荐答案

是的,实际上,这是减少项目POM中样板数量的标准做法.

Yes, in fact this is a standard practice to reduce the amount of boilerplate in project POMs.

有关父POM的更多信息:

For more information on parent POMs: https://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-project-relationships.html#pom-relationships-sect-project-inheritance

并使用仅POM的项目将样板保留在项目POM中: https://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-pom-best-practice.html

And for using POM-only projects to keep boilerplate out of project POMs: https://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-pom-best-practice.html

这篇关于公司范围内的父pom的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆