maven-child pom重写父级的plugin属性

70gysomp  于 2021-07-09  发布在  Java
关注(0)|答案(0)|浏览(313)

我可能在这里遗漏了一些概念性的要点,但是我想在pluginmanagement的父pom(skip=true)中定义一个插件,然后在子pom中定义一个概要文件来启用这个插件并覆盖部分配置部分( <file> ).
pom.xml文件

  1. <pluginManagement>
  2. <plugins>
  3. <plugin>
  4. <artifactId>maven-deploy-plugin</artifactId>
  5. <configuration>
  6. <skip>true</skip>
  7. </configuration>
  8. <executions>
  9. <execution>
  10. <id>deploy-file</id>
  11. <phase>deploy</phase>
  12. <goals>
  13. <goal>deploy-file</goal>
  14. </goals>
  15. <configuration>
  16. <file>none</file>
  17. <repositoryId>${project.distributionManagement.snapshotRepository.id}</repositoryId>
  18. <url>${project.distributionManagement.snapshotRepository.url}</url>
  19. <groupId>${project.groupId}</groupId>
  20. <artifactId>${project.artifactId}</artifactId>
  21. <version>${project.version}</version>
  22. <packaging>zip</packaging>
  23. </configuration>
  24. </execution>
  25. </executions>
  26. </plugin>
  27. </plugins>
  28. </pluginManagement>

模块a/pom.xml

  1. <profiles>
  2. <profile>
  3. <id>deploy-module-zip</id>
  4. <activation>
  5. <activeByDefault>false</activeByDefault>
  6. </activation>
  7. <build>
  8. <plugins>
  9. <plugin>
  10. <artifactId>maven-deploy-plugin</artifactId>
  11. <configuration>
  12. <skip>false</skip>
  13. </configuration>
  14. <executions>
  15. <execution>
  16. <id>deploy-file</id>
  17. <phase>deploy</phase>
  18. <goals>
  19. <goal>deploy-file</goal>
  20. </goals>
  21. <configuration>
  22. <file>module-a/target/module-a.zip</file>
  23. </configuration>
  24. </execution>
  25. </executions>
  26. </plugin>
  27. </plugins>
  28. </build>
  29. </profile>
  30. </profiles>

我面临的错误是部署进程找不到名为“none”的文件(父进程上定义的值,因为子进程 <file> “覆盖”不起作用)。

  1. Step 4/4: Deploy snapshot (Maven) (6s)
  2. [09:31:12][Step 4/4] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (deploy-file) on project module-parent: /sbclocal/localstorage/teamcity/agent_02/work/cff9a122f8eb31a3/none not found.
  3. [09:31:14][Step 4/4] Process exited with code 1 (Step: Deploy snapshot (Maven))
  4. [09:31:14][Step 4/4] Step Deploy snapshot (Maven) failed

我错过了什么?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题