简体   繁体   English

詹金斯的工作配置不同吗?

[英]Jenkins job with different configuration?

I am refactoring a single "too" big multiple module maven Jenkins job to about 10 smaller maven Jenkins jobs (one parent maven module with childs). 我将一个“太大”的多模块Maven Jenkins作业重构为大约10个较小的Maven Jenkins作业(一个带有子级的父Maven模块)。

I like to run a single maven job every 2 hours without the tests and source code analyzers like PMD and Checkstyle, and once a day during the night I want to run it with the tests and source code analyzers. 我喜欢每2小时运行一次单独的Maven作业,而无需测试和源代码分析器(例如PMD和Checkstyle),并且每天晚上,我想一次在测试和源代码分析器中运行它。

I am not sure how to do this best. 我不确定如何做到最好。 Jenkins is very flexible and I read the Jenkins O'Reilly book, but I am stil not sure how to do it :( I was thinking about using the Maven Jenkins plugin with job inheritances, but I still end up with many jobs I guess. Is this the way to go ? Jenkins非常灵活,我读过Jenkins O'Reilly的书,但我不确定如何做到这一点:(我当时正在考虑将Maven Jenkins插件与工作继承一起使用,但是我仍然想完成许多工作。这是要走的路吗?

Please some advice? 请一些建议? - Ed -埃德

One trick I use is to set a property for build phase for any plugin that I want to disable and set it manually in jenkins. 我使用的一个技巧是为要禁用的任何插件设置构建阶段的属性,并在jenkins中手动进行设置。 for example see the pmd plugin below: 例如,请参见下面的pmd插件:

See ${pmd.phase} 参见$ {pmd.phase}

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-pmd-plugin</artifactId>
    <version>2.5</version>
        <configuration>
            <targetJdk>1.6</targetJdk>
            <linkXref>false</linkXref>
            <failOnViolation>true</failOnViolation>
            <failurePriority>1</failurePriority>
            <rulesets>
                <ruleset>${pom.basedir}/pmd-rulesets.xml</ruleset>
            </rulesets>
         </configuration>
        <executions>
            <execution>
            <phase>${pmd.phase}</phase>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Now define 现在定义

<properties>
    <pmd.phase>none</pmd.phase>
</properties>

In jenkins set the Goals and options field to clean install -Dpmd.phase=validate 在jenkins中,将目标和选项字段设置为全新安装-Dpmd.phase = validate

The command line property overrides defined one so pmd will run only if the -Dpmd.phase=validate is present. 命令行属性将覆盖已定义的属性,因此仅当存在-Dpmd.phase = validate时,pmd才会运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM