In a Maven project, how can I automatically update the version all child modules, plus the parent?

StackOverflow https://stackoverflow.com/questions/2341906

문제

I have a multi-module project.

parent POM (1.0-SNAPSHOT)
|-- module1 (1.0-SNAPSHOT)
|-- module2 (1.0-SNAPSHOT)
`-- module3 (1.0-SNAPSHOT)

When I execute mvn release:prepare it verify that parent POM has a SNAPSHOT version and all dependent modules don't have a SNAPSHOT version. How automatically update all child modules from SNAPSHOT to the next release version?

I would like automatically increment version for all modules.

도움이 되었습니까?

해결책

제대로 얻는 경우 이미지와 왼쪽의 텍스트가 있습니다.텍스트와 이미지를 더 많은 공간으로 분리하고 싶습니다.내가 제안하는 것은 그들 사이에 추가적인 마진을 배치하는 것입니다.그렇게하십시오.

<img src="./img/fig.jpg" align="right" style="display:inline;margin:2px 2px 2px 5px;"/>
.

다른 팁

A flexible way to set poms versions, multi-modules projects included, is Versions Maven Plugin.

mvn versions:set -DnewVersion=your_new_version

It will adjust all pom versions, parent versions and children versions in a multi-module project.

then

mvn versions:commit

or

mvn versions:revert

SharePoint 2010/2007 목록 / 라이브러리에서 경고를 비활성화 / 활성화하려면 다음 코드를 사용하여 콘솔 응용 프로그램을 만듭니다.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using System.IO;

namespace EnableDisableAlertsInList
{
    class Program
    {
        static void Main(string[] args)
        {
            string site;
            string web;
            string list;
            string option;
            SPSite tmpSite = null;
        try
        {
            //Get the site collection , Sub-site, Lists
            if (args.Length != 3)
            {
                //Site collection
                Console.WriteLine("Enter the Site collection URL (E.g.)'http://intranet.company.com' : \n ----------------------------------- \n");
                site = Console.ReadLine();

                //Sub-Site
                Console.WriteLine("\n Enter the Sub-Site URL (E.g.) '/Sales/us' (  '/' for root web): \n -------------------------------------- ");
                web = Console.ReadLine();

                //List
                Console.WriteLine("\n Enter the List Name(Title): (E.g) 'Announcements' : \n -------------------------------------- ");
                list = Console.ReadLine();

                //Option ON or OFF
                Console.WriteLine("\n Enter the Option ON or OFF: \n ----------------------------------- \n ");
                option = Console.ReadLine();

            }
            else
            {
                site = args[0];
                web = args[1];
                list = args[2];
                option = args[3];
            }


            tmpSite = new SPSite(site);
            SPWeb tmpWeb = tmpSite.OpenWeb(web);
            SPList tmpList = tmpWeb.Lists[list];

            long alertCounter = 0;
            foreach (SPAlert tmpAlert in tmpWeb.Alerts)
            {
                option = option.ToUpper();

                if (option == "ON") //Turn it ON
                {
                    if ((tmpAlert.List.Title == tmpList.Title) & (tmpAlert.Status == SPAlertStatus.Off))
                    {
                        tmpAlert.Status = SPAlertStatus.On;
                        Console.WriteLine("Turning ON Alert: {0} in List: {1}", tmpAlert.Title, tmpList.Title);
                        tmpAlert.Update();
                        alertCounter++;
                    }
                }
                else if (option == "OFF") //Turn it ON
                {
                    if ((tmpAlert.List.Title == tmpList.Title) & (tmpAlert.Status == SPAlertStatus.On))
                    {
                        tmpAlert.Status = SPAlertStatus.Off;
                        Console.WriteLine("Turning OFF Alert: {0} in List :{1}", tmpAlert.Title, tmpList.Title);
                        tmpAlert.Update();
                        alertCounter++;
                    }

                }
            }

            //Just to pause
            Console.WriteLine("Done, Processed {0} Alerts! Press a key to Exit.", alertCounter);
            Console.ReadLine();

        }

        catch (Exception ex)
        {
            Console.WriteLine("Error: " + ex.Message);
            System.Diagnostics.EventLog.WriteEntry("Disable/Enable Alerts", ex.Message);
            Console.ReadLine();
        }

        finally
        {
            //Dispose of the Root Site Object
            tmpSite.Dispose();
        }
    }
}
}
.

소스

위의 코드가 당신을 돕기를 바랍니다 :)

There is a potentially better option over at https://issues.apache.org/jira/browse/MNG-624?focusedCommentId=14415968&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14415968

That is a workaround for the fact that you can't refer to the top level pom in the sub-module poms without having an explicit version listed. (which is what bug MNG-624 is about) It explains how you can have a single location for the version (in a top-level profiles.xml file), and simply have a property references in all the pom.xml files (i.e. ${currentVersion})

However, in this scheme release:prepare probably won't update profiles.xml for you.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top