Ivy makepom marks all dependencies as optional despite mapping

孤街醉人 提交于 2019-11-29 16:18:05

The optional dependency mapping appears to be the default behaviour.

Ivy is not restricted to a fixed number of scopes. While ivy configurations are much more flexible, you cannot assume that each configuration is being use to populate standard project classpaths....

The safest thing to do is provide an explicit mapping of each ivy configuration to the matching scope in Maven. In practice I recommend creating an ivy configuration to to emulate each Maven scope (regardless of whether it's used or not).

   <target name="generate-pom" depends="resolve" description="Generate Maven POM">
      <ivy:deliver deliverpattern="${build.dir}/ivy.xml" pubrevision="${project.version}"/>

      <ivy:makepom ivyfile="${build.dir}/ivy.xml" pomfile="${build.dir}/${ivy.module}.pom">
         <mapping conf="compile" scope="compile" />
         <mapping conf="runtime" scope="runtime" />
         <mapping conf="test"    scope="test" />
      </ivy:makepom>
   </target>

Note:

  • You omitted the deliver ivy task. Necessary to ensure that ivy dynamic revisions are resolved and that the ivy module has a revision tag set to expected published revision number. (Unlike Maven you don't need to edit the ivy file to increment a module version).

It seems that mapping "*" is harmless. Any other specific mappings will still take precedence.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!