Package com.atlassian.maven.plugins.jgitflow

Examples of com.atlassian.maven.plugins.jgitflow.MavenJGitFlowConfiguration


            {
                RefSpec developSpec = new RefSpec(ctx.getFlowInitContext().getDevelop());
                flow.git().push().setRemote(Constants.DEFAULT_REMOTE_NAME).setRefSpecs(developSpec).call();
            }

            MavenJGitFlowConfiguration config = configManager.getConfiguration(flow.git());
            config.setLastReleaseVersions(originalVersions);
            configManager.saveConfiguration(config,flow.git());
           
        }
        catch (JGitFlowException e)
        {
View Full Code Here


        try
        {
            Map<String, String> originalVersions = projectHelper.getOriginalVersions(reactorProjects);
            flow = JGitFlow.getOrInit(ctx.getBaseDir(), ctx.getFlowInitContext());

            MavenJGitFlowConfiguration config = configManager.getConfiguration(flow.git());
            String hotfixLabel = getReleaseLabel(ctx, reactorProjects);
           
            //We need to commit the hotfix versioned poms to develop to avoid a merge conflict
            flow.git().checkout().setName(flow.getDevelopBranchName()).call();
            updatePomsWithReleaseVersion(ctx, reactorProjects);
            flow.git().add().addFilepattern(".").call();
            flow.git().commit().setMessage("updating develop with hotfix versions to avoid merge conflicts").call();
           
            flow.git().checkout().setName(flow.getHotfixBranchPrefix() + hotfixLabel);

            if(ctx.isPush() || !ctx.isNoTag())
            {
                ensureOrigin(reactorProjects, flow);
            }

            getLogger().info("running jgitflow hotfix finish...");
            flow.hotfixFinish(hotfixLabel)
                .setPush(ctx.isPush())
                .setKeepBranch(ctx.isKeepBranch())
                .setNoTag(ctx.isNoTag())
                .setMessage(ReleaseUtil.interpolate(ctx.getTagMessage(), rootProject.getModel()))
                .call();

            //make sure we're on develop
            flow.git().checkout().setName(flow.getDevelopBranchName()).call();

            updatePomsWithPreviousVersions(ctx, reactorProjects, config);

            commitAllChanges(flow.git(), "updating poms for development");

            config.setLastReleaseVersions(originalVersions);
            configManager.saveConfiguration(config,flow.git());
        }
        catch (JGitFlowException e)
        {
            throw new JGitFlowReleaseException("Error releasing: " + e.getMessage(), e);
View Full Code Here

        return gson;
    }

    private MavenJGitFlowConfiguration loadConfiguration(File configFile)
    {
        MavenJGitFlowConfiguration loadedConfig = null;
        try
        {
            if (!configFile.exists())
            {
                Files.write("{}".getBytes(),configFile);
View Full Code Here

    @Override
    public void finish(ReleaseContext ctx, List<MavenProject> originalProjects, MavenSession session) throws JGitFlowReleaseException
    {
        JGitFlow flow = null;
        MavenJGitFlowConfiguration config = null;
        try
        {
            flow = JGitFlow.getOrInit(ctx.getBaseDir(), ctx.getFlowInitContext());

            writeReportHeader(ctx,flow.getReporter());
View Full Code Here

    @Override
    public void finish(ReleaseContext ctx, List<MavenProject> originalProjects, MavenSession session) throws JGitFlowReleaseException
    {
        JGitFlow flow = null;
        MavenJGitFlowConfiguration config = null;
        try
        {
            flow = JGitFlow.forceInit(ctx.getBaseDir(), ctx.getFlowInitContext());

            writeReportHeader(ctx,flow.getReporter());
View Full Code Here

{
    @Override
    public void start(ReleaseContext ctx, List<MavenProject> originalProjects, MavenSession session) throws JGitFlowReleaseException
    {
        JGitFlow flow = null;
        MavenJGitFlowConfiguration config = null;
        try
        {
            flow = JGitFlow.getOrInit(ctx.getBaseDir(), ctx.getFlowInitContext());

            writeReportHeader(ctx,flow.getReporter());
View Full Code Here

    @Override
    public void finish(ReleaseContext ctx, List<MavenProject> originalProjects, MavenSession session) throws JGitFlowReleaseException
    {
        JGitFlow flow = null;
        MavenJGitFlowConfiguration config = null;

        try
        {
            flow = JGitFlow.getOrInit(ctx.getBaseDir(), ctx.getFlowInitContext());
View Full Code Here

        Map<String, String> originalVersions = projectHelper.getOriginalVersions(reactorProjects);

        JGitFlow flow = null;
        String hotfixLabel = "";
        MavenJGitFlowConfiguration config = null;
        try
        {
            flow = JGitFlow.getOrInit(ctx.getBaseDir(), ctx.getFlowInitContext());

            if(ctx.isPush() || !ctx.isNoTag())
            {
                ensureOrigin(reactorProjects, flow);
            }
           
            config = configManager.getConfiguration(flow.git());

            hotfixLabel = getHotfixLabel(ctx, reactorProjects, config);
            flow.hotfixStart(hotfixLabel).call();
        }
        catch (HotfixBranchExistsException e)
        {
            try
            {
                List<Ref> refs = GitHelper.listBranchesWithPrefix(flow.git(),flow.getHotfixBranchPrefix());
                boolean foundOurRelease = false;
                for(Ref ref : refs)
                {
                    if(ref.getName().equals(Constants.R_HEADS + flow.getHotfixBranchPrefix() + hotfixLabel))
                    {
                        foundOurRelease = true;
                        break;
                    }
                }

                if(foundOurRelease)
                {
                    //since the release branch already exists, just check it out
                    flow.git().checkout().setName(flow.getHotfixBranchPrefix() + hotfixLabel).call();  
                }
                else
                {
                    throw new JGitFlowReleaseException("Error starting hotfix: " + e.getMessage(), e);
                }
               
            }
            catch (GitAPIException e1)
            {
                throw new JGitFlowReleaseException("Error checking out existing hotfix branch: " + e1.getMessage(), e1);
            }
            catch (JGitFlowGitAPIException e1)
            {
                e1.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            }
        }
        catch (JGitFlowException e)
        {
            throw new JGitFlowReleaseException("Error starting hotfix: " + e.getMessage(), e);
        }
        catch (IOException e)
        {
            throw new JGitFlowReleaseException("Error starting hotfix: " + e.getMessage(), e);
        }

        updatePomsWithHotfixVersion(ctx, reactorProjects, config);

        commitAllChanges(flow.git(), "updating poms for " + hotfixLabel + " hotfix");

        try
        {
            //save original versions to file so we can use them when we finish
            config.setPreHotfixVersions(originalVersions);
            configManager.saveConfiguration(config, flow.git());
        }
        catch (IOException e)
        {
            //just ignore for now
View Full Code Here

            {
                RefSpec developSpec = new RefSpec(ctx.getFlowInitContext().getDevelop());
                flow.git().push().setRemote(Constants.DEFAULT_REMOTE_NAME).setRefSpecs(developSpec).call();
            }

            MavenJGitFlowConfiguration config = configManager.getConfiguration(flow.git());
            config.setLastReleaseVersions(originalVersions);
            configManager.saveConfiguration(config,flow.git());
           
        }
        catch (JGitFlowException e)
        {
View Full Code Here

        try
        {
            Map<String, String> originalVersions = projectHelper.getOriginalVersions(reactorProjects);
            flow = JGitFlow.getOrInit(ctx.getBaseDir(), ctx.getFlowInitContext());

            MavenJGitFlowConfiguration config = configManager.getConfiguration(flow.git());
            String hotfixLabel = getReleaseLabel(ctx, reactorProjects);
           
            //We need to commit the hotfix versioned poms to develop to avoid a merge conflict
            flow.git().checkout().setName(flow.getDevelopBranchName()).call();
            updatePomsWithReleaseVersion(ctx, reactorProjects);
            flow.git().add().addFilepattern(".").call();
            flow.git().commit().setMessage("updating develop with hotfix versions to avoid merge conflicts").call();
           
            flow.git().checkout().setName(flow.getHotfixBranchPrefix() + hotfixLabel);

            if(ctx.isPush() || !ctx.isNoTag())
            {
                ensureOrigin(reactorProjects, flow);
            }

            getLogger().info("running jgitflow hotfix finish...");
            flow.hotfixFinish(hotfixLabel)
                .setPush(ctx.isPush())
                .setKeepBranch(ctx.isKeepBranch())
                .setNoTag(ctx.isNoTag())
                .setMessage(ReleaseUtil.interpolate(ctx.getTagMessage(), rootProject.getModel()))
                .call();

            //make sure we're on develop
            flow.git().checkout().setName(flow.getDevelopBranchName()).call();

            updatePomsWithPreviousVersions(ctx, reactorProjects, config);

            commitAllChanges(flow.git(), "updating poms for development");

            config.setLastReleaseVersions(originalVersions);
            configManager.saveConfiguration(config,flow.git());
        }
        catch (JGitFlowException e)
        {
            throw new JGitFlowReleaseException("Error releasing: " + e.getMessage(), e);
View Full Code Here

TOP

Related Classes of com.atlassian.maven.plugins.jgitflow.MavenJGitFlowConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.