Jenkins中的Munit依赖于Domain项目

时间:2018-08-14 18:18:22

标签: maven jenkins mule munit

我有一个Mule项目“ A”,它引用一个域项目“ X”。我想在Jenkins中为项目“ A”运行我的MUnits,但是由于找不到依赖项域项目“ X”而失败。 为了解决这个问题,我在项目“ X” pom中添加了域项目“ A”的“依赖项”。 xml。但没有运气。

请详细说明如何解决将MUnits ion Jenkins作为生成后操作运行的问题。

谢谢, 伊克拉姆

1 个答案:

答案 0 :(得分:0)

要做到这一点,我必须:

  • 首先,在pom中添加具有“ test”作用域的域依赖项

    <dependency>
         <groupId>com.mygroupid</groupId>
         <artifactId>mule-domain-id</artifactId>
         <version>1.0.0</version>
         <scope>test</scope>
         <type>zip</type>
    </dependency>
    
  • 第二,您必须将域工件安装在一个工件存储库(例如Nexus)中。这样,可以从Jenkins访问该依赖关系。然后将该存储库添加到您的pom.xml

    <repositories>
      <repository>
        <id>alm-nexus</id>
        <name>ALM Nexus Repo</name>
        <url>https://nexus.alm.corp/repository/maven-public</url>
        <layout>default</layout>
      </repository>
    </repositories>
    
  • 在Jenkins中运行MUnit的一件重要事情如下。根文件夹名称必须与artifactId完全相同,因此在Jenkins中,必须使用自定义文件夹设置工作区。 如果使用Jenkinsfile,则可以执行以下操作:

      

    customWorkspace   “ $ {env.JOB_NAME} / $ {env.BUILD_ID} / artifact-id-has-to-go-here“

通过这些步骤,我们可以将MUnit测试作为其中一个阶段来建立一个工作管道。