effective-pom是超级pom和应用程序POM之间的合并

2024-02-04

我尝试使用 mvn help: effective-pom 命令在示例应用程序上生成有效的 pom。http://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-pom.html http://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-pom.html在这篇文章中,它说有效的pom是超级pom和应用程序pom之间的合并。

但是,当我查看我的 effective-pom 时,它包含未包含在 super pom 或 effective pom 中的元素。

是否还有其他因素决定有效 pom.xml 的内容?

下面给出的是超级 pom 和应用程序 pom,这两个 pom 都没有 mavne-jar-plugin 或 maven-compiler-plugin,但在我的 effective-pom 中,我可以在构建部分看到这些插件。那么如何添加呢。

预先感谢您为澄清此问题提供的任何帮助

超级聚甲醛

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<!-- START SNIPPET: superpom -->
<project>
  <modelVersion>4.0.0</modelVersion>

  <repositories>
    <repository>
      <id>central</id>
      <name>Central Repository</name>
      <url>http://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>http://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>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.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.0</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</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>
<!-- END SNIPPET: superpom -->

应用POM

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.sonatype.mavenbook.ch08</groupId>
    <artifactId>simplest-project</artifactId>
    <packaging>jar</packaging>
    <version>1</version>
</project>

有效的pom


有效的 POM 由 Super POM + 应用程序 POM + settings.xml 内容 + 插件组成,默认情况下根据所选的打包类型(因此基于应用程序 POM 中的一个元素)绑定到生命周期。

你问的是maven-jar-plugin and maven-compiler-plugin。默认情况下,它们绑定到生命周期,因为您的应用程序 POM 指定jar包装。

您可以在中看到默认绑定$YOUR_REPO_LOCATION\org\apache\maven\maven-core\3.0.x\maven-core-3.0.x.jar\META-INF\plexus\components.xml或在文档 http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

effective-pom是超级pom和应用程序POM之间的合并 的相关文章

随机推荐

  • MySQL - 获取组的 sum() 分组 max()

    我有如下表结构 每行都是一场游戏 每个人每个月可以玩很多次或不玩 id person score date 1 32 444 2011 05 2 65 528 2011 05 3 77 455 2011 05 4 32 266 2011 0
  • MySQL:主机列中的 % 代表什么以及如何更改用户密码

    嗯 这就是我能看到的 select host user from mysql user host user me 127 0 0 1 root 1 root localhost localhost debian sys maint loca
  • JDBC 字符编码

    我有一个在 GlassFish 3 上运行的 Java Web 应用程序和在 MySQL 上运行的 JPA EclipseLink 我面临的问题是 如果我使用以下命令将实体保存到数据库中update 方法 String领域失去完整性 显示而
  • 在编译时计算小整数的阶乘

    我刚刚实现 再次 一个递归模板 用于在编译时计算整数的阶乘 谁会想到有一天我实际上会需要它 不过 我没有自己动手 而是去了Boost http www boost org 寻找答案 然而 特殊数学中的阶乘函数明确禁止将其与整数类型一起使用
  • 在Java BufferedImage中绘制完全透明的“白色”

    这可能听起来有点奇怪 但请耐心听一下 那里is一个原因 我正在尝试在灰色背景上的文本周围生成白色发光 为了生成发光 我创建了一个比文本大的新 BufferedImage 然后将白色文本绘制到图像的画布上 并通过卷积运算 http docs
  • 如何在Python中将csv转换为json?

    我对编程非常陌生 过去 3 4 周一直在学习 python 这是给出的作业之一 Input A B C D 1 2 3 4 5 6 7 8 Output A 1 B 2 C 3 D 4 A 5 B 6 C 7 D 8 我一直在尝试将代码设置
  • stat_smooth 和 geom_ribbon 之间的交互不良

    我正在回答这个问题 https stackoverflow com questions 64574595 geom density returns plot without considering real values 这需要绘制平滑区域
  • 如何在Python中基于if语句保存一个文档?

    我正在尝试根据 if 语句保存文档 我在这里创建单选按钮 info Option 1 Option 2 Option 3 vars for idx i in enumerate info var IntVar value 0 vars ap
  • NoClassDefFoundError:配置属性源

    从昨天开始 在全新安装后 我们的 spring boot 项目在没有更改 Maven 文件 库或其他配置的情况下出现了问题 我们确实尝试将 SpringFrameWork 和 Spring boot 的 pom 版本更新到 1 5 4 Re
  • 整数数组作为字典的键

    我希望拥有使用整数数组作为键的字典 如果整数数组具有相同的值 甚至不同的对象实例 它们将被视为相同的键 我该怎么做呢 以下代码不起作用b是不同的对象实例 int a new int 1 2 3 int b new int 1 2 3 Dic
  • 如何获取所有 Spark 配置以及默认配置?

    我正在开发一个项目 需要收集所有 Spark 配置 问题是 如果没有明确设置参数 我将需要默认值 有没有办法获取所有配置 包括所有默认值 我尝试过 sc getConf getAll 但通过这种方式 我没有得到默认值 SparkListen
  • Java 卡连接到模拟器失败

    我正在尝试测试 Java Card 小程序以建立与 cref 等模拟器的连接 try sckClient new Socket localhost 9025 InputStream is sckClient getInputStream O
  • 如何使用 PHP、CURL 抓取 javascript 网站 [重复]

    这个问题在这里已经有答案了 可能的重复 如何在 PHP 应用程序内从另一个站点呈现 javascript https stackoverflow com questions 5332161 how do i render javascrip
  • flutter:地理定位器不起作用,请确保清单中至少定义了 ACCESS_FINE_LOCATION 或 ACCESS_COARSE_LOCATION

    我正在尝试使用地理定位器 并且我添加了两者
  • Java中的中断线程

    我想优雅地关闭线程 我在网上看到了很多代码并在这里查询 我认为有两种关闭方法 使用布尔标志 只要改变一个标志 我们就可以在 run 方法中破坏代码 使用中断方法 我的问题是 为什么要避免使用布尔标志来正常关闭线程 当我运行示例程序时 它运行
  • 链接静态方法

    这可能没有解决方案 或者我可能找不到解决方案 但这里是 注意 我知道下面的代码是不正确的 我只是想展示我到底是什么想去完成 我想做一些事情 public class ActionBarHandler public static Action
  • Rails - 如何获取访问者的IP地址?

    我需要将访问者的 IP 地址存储到我们的数据库中 这是我尝试执行此操作的方法 ip request remote ip ip request env REMOTE ADDR 但在这两种情况下 ip变量存储值127 0 0 1 即使我将应用程
  • C:对不完整类型的数组添加下标合法吗?

    我在标准中找不到相关位 但 gcc 和 clang 允许这样做 所以我想我想知道它是编译器扩展还是语言的一部分 如果可以的话请提供一个链接 这可能会因以下情况而出现 extern char arr func arr 7 No error 后
  • 作为 IntelliJ 插件的“查找用法”功能

    我试图在 IntelliJ IDEA 中找到一种方法来查找特定项目中一些库方法调用和类的所有用法 目标是编译引用这些特定方法或类的类列表 我该怎么办呢 我可以看到有一个MethodReferencesSearch看起来它可能会有所帮助 但是
  • effective-pom是超级pom和应用程序POM之间的合并

    我尝试使用 mvn help effective pom 命令在示例应用程序上生成有效的 pom http books sonatype com mvnref book reference pom relationships sect po