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

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

    • <bdo id='RJkVm'></bdo><ul id='RJkVm'></ul>
    <legend id='RJkVm'><style id='RJkVm'><dir id='RJkVm'><q id='RJkVm'></q></dir></style></legend>

    1. 如何在 tycho 中引用 mockito?

      时间:2023-09-25

      1. <legend id='RXM5C'><style id='RXM5C'><dir id='RXM5C'><q id='RXM5C'></q></dir></style></legend>
        • <bdo id='RXM5C'></bdo><ul id='RXM5C'></ul>
        • <i id='RXM5C'><tr id='RXM5C'><dt id='RXM5C'><q id='RXM5C'><span id='RXM5C'><b id='RXM5C'><form id='RXM5C'><ins id='RXM5C'></ins><ul id='RXM5C'></ul><sub id='RXM5C'></sub></form><legend id='RXM5C'></legend><bdo id='RXM5C'><pre id='RXM5C'><center id='RXM5C'></center></pre></bdo></b><th id='RXM5C'></th></span></q></dt></tr></i><div id='RXM5C'><tfoot id='RXM5C'></tfoot><dl id='RXM5C'><fieldset id='RXM5C'></fieldset></dl></div>
              <tbody id='RXM5C'></tbody>

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

                <tfoot id='RXM5C'></tfoot>
                本文介绍了如何在 tycho 中引用 mockito?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我目前正在尝试让 tycho 完成我的构建(约 30 个捆绑包).
                在我的单元测试中使用 的说明.(我不确定您是否需要指定解析器).

                关于 Nexus 中对 p2 存储库的支持,我的理解是 Nexus 的 p2 插件已经开源:

                • Nexus - P2 存储库插件
                • Nexus - Bundle Maker
                • nexus-p2-repository-plugin 的 Github 存储库

                I'm currently trying to get my build (~30 bundles) done by tycho.
                I faced some confusing problems when using Mockito in my unit tests.
                I created an eclipse-test-plugin as fragment project to the tested bundle. Since tycho should resolve the required bundles using the manifest, I removed the dependency to mockito from the pom.xml.
                When I then try to add mockito to the required bundles in the manifest mockito isn't listed. I found this post and created a target platform pointing to eclipse indigo.
                I included the platform specifics so I don't need the eclipse delta pack. Then the first strange thing occurs. Eclipse is telling me that there are some unsatisfiably dependencies and when I set the newly created target platform as active within eclipse, no more packages like org.osgi.framework, etc. can be resolved by eclipse. But when I build an eclipse-product using tycho and the target platform it is working.

                If I set the current eclipse installation as active platform the bundles are resolved. I've selected the following of the indigo release:

                • Eclipse RCP Plug-in Developer Resources
                • Equinox Target Components
                • Jetty Target Components

                So my first question is "What is wrong with my target-platform so that tycho is able to use it but eclipse isn't?"

                To get closer to my original problem (getting mockito running) I set the current eclipse installation as the active target platform. Eclipse then can resolve the org.osgi.framework package and others.
                I added then the previously removed dependency to mockito again to my pom.xml like in the above-mentioned post. But I still can't find mockito when I try to add it to the required bundles in the manifest.

                So my second question is "What am I doing wrong? How do you reference bundles that are not published at the eclipse update site, e.g. the maven central repository?"

                Update: During my research I found two ways of including bundles from non-p2-update-sites in my target-platform:

                1. Nexus Pro
                  The professional version of Nexus supports p2-Proxy repositories which can wrap default maven repositories like the Maven Central Repository into a p2 update-site, but the professional version costs round about $800 per year.
                2. Create an eclipse-repository
                  You can create a new maven project with packaging eclipse-repository including all your desired bundles. The created artifact is then deployed to a common web server.

                In your target-platform you can then reference the Nexus p2-proxy repo or the web hosted p2-repo.
                Does anyone know other ways - probably more convenient/less expensive?

                Please help me understand the confusing world of tycho a bit more...
                Thanks in advance

                解决方案

                If mockito isn't in your target platform (and you don't have it in a p2 repository), the easiest thing to do is probably to re-add the dependency back into your pom (without removing the mockito import from your manifest).

                I think you'll also need to specify the following in the pom, in the configuration for the target-platform-configuration plugin:

                  <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>target-platform-configuration</artifactId>
                    <version>${tycho-version}</version>
                    <configuration>
                      <pomDependencies>consider</pomDependencies>
                    </configuration>
                  </plugin>
                

                See the instructions on adding a dependency on a pom-first artifact. (I'm not sure whether you'll need to specify the resolver).

                Regarding support for p2 repositories in Nexus, my understanding is that the p2 plugin for Nexus has since been open-sourced:

                • Nexus - P2 Repository Plugin
                • Nexus - Bundle Maker
                • Github repository for nexus-p2-repository-plugin

                这篇关于如何在 tycho 中引用 mockito?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:Mockito 绕过静态方法进行测试 下一篇:具有泛型的模拟方法并在返回类型中扩展

                相关文章

                最新文章

                <tfoot id='wdqzy'></tfoot>
              • <small id='wdqzy'></small><noframes id='wdqzy'>

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

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

                    <bdo id='wdqzy'></bdo><ul id='wdqzy'></ul>