Example #1
0
    public static void UpdateMavenVersionNumber(string typeOfChange, string version, MavenSettings settings)
    {
        ICakeContext context = Context;
        MavenRunner  runner  = new MavenRunner(context.FileSystem,
                                               context.Environment,
                                               context.Globber,
                                               context.ProcessRunner,
                                               context.Tools,
                                               context.Log);

        context.Information(string.Format("[{0}] Updating project to version {1} using {2}:{3}", typeOfChange, version, GroupId, ArtifactId));

        MavenSettings s = new MavenSettings(settings);

        s.Goal.Add("versions:set");
        s.Properties.Add("newVersion", version);
        if (!string.IsNullOrEmpty(GroupId))
        {
            s.Properties.Add("groupdId", GroupId);
        }
        if (!string.IsNullOrEmpty(ArtifactId))
        {
            s.Properties.Add("artifactId", ArtifactId);
        }
        runner.ExecuteScript(s);
    }
Example #2
0
    public static void Configure(ICakeContext c)
    {
        Context  = c;
        Settings = new MavenSettings();

        if (Context.HasEnvironmentVariable("MAVEN_ALT_DEPLOY_REPOSITORY"))
        {
            Settings.Properties.Add("altDeploymentRepository", Context.EnvironmentVariable("MAVEN_ALT_DEPLOY_REPOSITORY"));
        }
        if (Context.HasEnvironmentVariable("MAVEN_SETTINGS_LOCATION"))
        {
            Settings.Properties.Add("altDeploymentRepository", Context.EnvironmentVariable("MAVEN_ALT_DEPLOY_REPOSITORY"));
        }
    }
Example #3
0
    public static void RunMaven(MavenSettings settings = null)
    {
        ICakeContext context = Context;
        MavenRunner  runner  = new MavenRunner(context.FileSystem,
                                               context.Environment,
                                               context.Globber,
                                               context.ProcessRunner,
                                               context.Tools,
                                               context.Log);

        MavenSettings s = new MavenSettings(settings);

        s.Merge(Settings);
        s.Merge(settings);
        runner.ExecuteScript(s);
    }
Example #4
0
    public void Merge(MavenSettings copy)
    {
        if (copy == null)
        {
            return;
        }

        Phase.AddRange(copy.Phase);
        Goal.AddRange(copy.Goal);
        Profiles.AddRange(copy.Profiles);
        foreach (var property in copy.Properties)
        {
            Properties[property.Key] = property.Value;
        }
        if (copy.SettingsFile != null)
        {
            SettingsFile = copy.SettingsFile;
        }
        if (copy.BatchMode != null)
        {
            BatchMode = copy.BatchMode;
        }
        if (copy.NonRecursive != null)
        {
            NonRecursive = copy.NonRecursive;
        }
        if (copy.Offline != null)
        {
            Offline = copy.Offline;
        }
        if (copy.ForceUpdate != null)
        {
            ForceUpdate = copy.ForceUpdate;
        }

        if (copy.ToolPath != null)
        {
            ToolPath = copy.ToolPath;
        }
        if (copy.ToolTimeout != null)
        {
            ToolTimeout = copy.ToolTimeout;
        }
        if (copy.WorkingDirectory != null)
        {
            WorkingDirectory = copy.WorkingDirectory;
        }
        if (copy.ArgumentCustomization != null)
        {
            ArgumentCustomization = copy.ArgumentCustomization;
        }
        if (copy.EnvironmentVariables != null)
        {
            if (EnvironmentVariables == null)
            {
                EnvironmentVariables = new Dictionary <string, string>(copy.EnvironmentVariables);
            }
            else
            {
                foreach (var pair in copy.EnvironmentVariables)
                {
                    EnvironmentVariables[pair.Key] = pair.Value;
                }
            }
        }
    }
Example #5
0
 public MavenSettings(MavenSettings copy) : this()
 {
     Merge(copy);
 }