开发者

pom changes needed to get JIRA link

How do I configure my changes.xml and pom file in order to link JIRA issue on th开发者_JAVA百科e maven site. I am including the maven-changes plugin. But I want to see how do we add for JIRA as I add the following for bugzilla.

JIRA https://bugs.abc.corp/enter_bug.cgi?product=${project.groupId}&component=${project.artifactId}

     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-changes-plugin</artifactId>
        <version>2.2</version>
        <configuration>
           <issueLinkTemplatePerSystem>
              <bugzilla><![CDATA[http://internal.bugtracker/show_bug.cgi?id=%ISSUE%]]></bugzilla>
              <navigator><![CDATA[http://external.bugtracker/?cr=%ISSUE%]]></navigator>
           </issueLinkTemplatePerSystem>
        </configuration>
        <reportSets>
           <reportSet>
              <reports>
                 <report>changes-report</report>
              </reports>
           </reportSet>
        </reportSets>
     </plugin>
     <plugin>


Of course, it is a great idea to take a look at the docs, as Raghuram suggested. JIRA is one of the pre-configured systems, and its standard URL for issues is %URL%/%ISSUE%.

From the XML snippet I understand you have added the issueLinkTemplatePerSystem configuration in the reporting section of the pom file. I have been struggling with this until I have tried adding that configuration to the pluginManagement section instead:

<project>
    <!-- ... -->
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-changes-plugin</artifactId>
                    <version>2.9</version>
                    <configuration>
                        <issueLinkTemplatePerSystem>
                            <system1>https://a.b.c/ticket?id=%ISSUE%</system1>
                            <system2>https://foo.bar/baz/%ISSUE%/view</system2>
                        </issueLinkTemplatePerSystem>
                    </configuration>
                </plugin>
                <!-- ... -->
            </plugins>
        </pluginManagement>
        <!-- ... -->
    </build>
    <!-- ... -->
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-changes-plugin</artifactId>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>changes-report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>
    <!-- ... -->
</project>

Then it worked like a charm, being able to use several different systems (with different template URLs) in changes.xml. I did not find this in the documentation.

Hint: try adding the option --debug (mvn --debug clean changes:changes-report) to see the IMSs taken by the plugin from the configuration.


Perhaps you should try the steps documented in Linking to Your Issue Management System section of the usage page of the plugin.

According to it, from version 2.4, the plugin comes pre-configured for a bunch of issue tracking systems, including jira. Quoting from the page,

If you use the issue attribute in your changes.xml file and have the element configured in your pom.xml, the report will contain links to the issues in your issue management system.


This is how I got it working for bugzilla and jira. So you just need to add an extra row - You may put the url instead of the variable "%"

<reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-changes-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <issueLinkTemplatePerSystem>
                        <jira><![CDATA[%URL%/browse/%ISSUE%]]></jira>
                        <bugzilla><![CDATA[http://bugzill.url/show_bug.cgi?id=%ISSUE%]]></bugzilla>
                    </issueLinkTemplatePerSystem>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>changes-report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
</reporting>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜