<small id='0Jf6Q'></small><noframes id='0Jf6Q'>

    <tfoot id='0Jf6Q'></tfoot>
    <legend id='0Jf6Q'><style id='0Jf6Q'><dir id='0Jf6Q'><q id='0Jf6Q'></q></dir></style></legend>

      • <bdo id='0Jf6Q'></bdo><ul id='0Jf6Q'></ul>

      1. <i id='0Jf6Q'><tr id='0Jf6Q'><dt id='0Jf6Q'><q id='0Jf6Q'><span id='0Jf6Q'><b id='0Jf6Q'><form id='0Jf6Q'><ins id='0Jf6Q'></ins><ul id='0Jf6Q'></ul><sub id='0Jf6Q'></sub></form><legend id='0Jf6Q'></legend><bdo id='0Jf6Q'><pre id='0Jf6Q'><center id='0Jf6Q'></center></pre></bdo></b><th id='0Jf6Q'></th></span></q></dt></tr></i><div id='0Jf6Q'><tfoot id='0Jf6Q'></tfoot><dl id='0Jf6Q'><fieldset id='0Jf6Q'></fieldset></dl></div>
      2. 如何减去常春藤依赖集

        时间:2023-07-14
            1. <legend id='fKtMh'><style id='fKtMh'><dir id='fKtMh'><q id='fKtMh'></q></dir></style></legend>
              • <bdo id='fKtMh'></bdo><ul id='fKtMh'></ul>

                <small id='fKtMh'></small><noframes id='fKtMh'>

                <i id='fKtMh'><tr id='fKtMh'><dt id='fKtMh'><q id='fKtMh'><span id='fKtMh'><b id='fKtMh'><form id='fKtMh'><ins id='fKtMh'></ins><ul id='fKtMh'></ul><sub id='fKtMh'></sub></form><legend id='fKtMh'></legend><bdo id='fKtMh'><pre id='fKtMh'><center id='fKtMh'></center></pre></bdo></b><th id='fKtMh'></th></span></q></dt></tr></i><div id='fKtMh'><tfoot id='fKtMh'></tfoot><dl id='fKtMh'><fieldset id='fKtMh'></fieldset></dl></div>
                  <tbody id='fKtMh'></tbody>
                  <tfoot id='fKtMh'></tfoot>

                • 本文介绍了如何减去常春藤依赖集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我的目标是将项目传递依赖关系划分为几个不交叉的集合:

                  My goal is to demarcate project transitive dependencies into several not crossing sets:

                  • 系统(已存在于 j2ee 容器中的 jar;手动列出并带有明确的固定版本)
                  • 提供(要复制到 j2ee 容器的 jar;手动列出)
                  • ear(罐子装在 ear/lib 中,其余的)

                  下面列出的我目前的解决方案有一些缺点:

                  My current solution listed below has some shortcomings:

                  • 必须从 ear conf 中逐一排除系统和提供的库
                  • 尚未明确排除的新的第三方可传递部门可能会意外听到
                  • 有时必须添加显式 override 复制库名称和版本
                  • have to exclude system and provided libraries from ear conf one by one
                  • new third-party transitive deps that weren't already explicitly excluded could accidentally get to ear
                  • sometimes have to add explicit override duplicating library name and version

                  有什么办法可以消除这些缺点吗?

                  Is there some approach possible to eliminate these shortcomings?

                  如果能够以某种方式定义一个conf作为其他依赖集减法的结果(通过优雅的冲突解决),那就太好了:ear = 运行时 - 系统 - 提供.

                  It would be nice to be able somehow define one conf as a result of dependency sets subtraction of the others (with graceful conflict resolution): ear = runtime - system - provided.

                  当 IVY-982 得到修复.

                  寻找实际的解决方案来应用.

                  Looking for an actual solution to apply.

                  如果有解决方案,甚至愿意考虑切换到 gradle.

                  Even willing to consider switching to gradle if it has a solution.

                  <?xml version="1.0" encoding="UTF-8"?>
                  <ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                              xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
                  
                      <info organisation="example.com" module="parent"/>
                  
                      <configurations defaultconfmapping="compile->@;runtime->@;system->master;provided->runtime;ear->runtime;test->test(default)">
                          <conf name="compile"/>
                          <conf name="runtime" extends="compile"/>
                          <conf name="ear" extends="runtime" description="Libs to be packed inside ear"/>
                          <conf name="provided" description="Libs to copy to j2ee container"/>
                          <conf name="system" description="Libs already present in j2ee container"/>
                          <conf name="test" extends="ear,provided,system" description="Simulate container environment. Used by unit tests to catch dependency compatibility problems."/>
                      </configurations>
                  
                      <dependencies>
                          <dependency org="log4j" name="log4j" rev="1.2.15" force="true" conf="system"/>
                          <dependency org="commons-collections" name="commons-collections" rev="3.1" force="true" conf="system"/>
                          <dependency org="commons-lang" name="commons-lang" rev="2.2" force="true" conf="system"/>
                  
                          <dependency org="org.apache.velocity" name="velocity" rev="1.7" force="true" conf="provided"/>
                          <dependency org="org.slf4j" name="slf4j-api" rev="1.5.6" force="true" conf="provided"/>
                          <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.6" force="true" conf="provided"/>
                          <!-- ... -->
                  
                          <dependency name="module1" rev="latest.integration" conf="runtime,ear,provided,test"/>
                          <dependency name="module2" rev="latest.integration" conf="runtime,ear,provided,test"/>
                          <!-- ... -->
                  
                          <exclude org="commons-collections" conf="ear,provided"/>
                          <exclude org="commons-lang" conf="ear,provided"/>
                          <exclude org="org.apache.velocity" conf="ear"/>
                          <!-- TODO: negation not working: https://issues.apache.org/jira/browse/IVY-982 -->
                          <!--<exclude org="org.slf4j" conf="*, !provided"/>-->
                          <exclude org="org.slf4j" conf="ear,test"/>
                          <!-- ... -->
                  
                          <override org="org.slf4j" rev="1.5.6"/>
                          <override org="commons-collections" module="commons-collections" rev="3.1"/>
                          <override org="commons-lang" module="commons-lang" rev="2.2"/>
                          <!-- ... -->
                      </dependencies>
                  
                  </ivy-module>
                  

                  可以在 IVY-1443 附件中找到要试验的示例项目源.

                  Sample project sources to experiment with can be found in IVY-1443 attachment.

                  推荐答案

                  虽然提供的依赖项排除可以通过 Maven和Gradle,目前好像有没有办法用常春藤轻松实现它.

                  While provided dependencies exclusion is possible with Maven and Gradle, it seems that currently there is no way to easily achieve it with ivy.

                  更新

                  在某些情况下,可以使用中间诱导模块和 否定正则表达式 掩码:

                  In some cases the task can be worked around with intermediate induced module and negative regexp mask:

                      <dependency org="com.company" name="root.module" conf="ear" rev="latest.integration">
                          <exclude org="^(?!com.company).*$" matcher="regexp"/>
                      </dependency>
                  

                  但我们已经转移到 Gradle,因为 Ivy 似乎正在失去动力.

                  But we've already moved to Gradle as Ivy seems to be losing momentum.

                  这篇关于如何减去常春藤依赖集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在jar依赖中读取资源文件 下一篇:如何在 Spring applicationContext 中读取系统环境变量

                  相关文章

                  <legend id='OW7wr'><style id='OW7wr'><dir id='OW7wr'><q id='OW7wr'></q></dir></style></legend>

                    <tfoot id='OW7wr'></tfoot>

                    <small id='OW7wr'></small><noframes id='OW7wr'>

                      <i id='OW7wr'><tr id='OW7wr'><dt id='OW7wr'><q id='OW7wr'><span id='OW7wr'><b id='OW7wr'><form id='OW7wr'><ins id='OW7wr'></ins><ul id='OW7wr'></ul><sub id='OW7wr'></sub></form><legend id='OW7wr'></legend><bdo id='OW7wr'><pre id='OW7wr'><center id='OW7wr'></center></pre></bdo></b><th id='OW7wr'></th></span></q></dt></tr></i><div id='OW7wr'><tfoot id='OW7wr'></tfoot><dl id='OW7wr'><fieldset id='OW7wr'></fieldset></dl></div>
                      • <bdo id='OW7wr'></bdo><ul id='OW7wr'></ul>