Пример #1
0
        private List <MavenCoordinates> Verify(MavenCoordinates coordinates, OverwriteOption overwrite)
        {
            if (overwrite == OverwriteOption.Replace)
            {
                return(new List <MavenCoordinates> {
                    coordinates
                });
            }

            var artifact = new Model.Artifact(coordinates);
            var search   = Artifactory.Search()
                           .ArtifactsByGavc()
                           .GroupId(coordinates.GroupId)
                           .ArtifactId(coordinates.ArtifactId)
                           .Version(coordinates.Version);
            var run = search.Run();

            if (run.Artifacts != null && run.Artifacts.Count > 0)
            {
                if (overwrite == OverwriteOption.Abort)
                {
                    throw new ArgumentException(artifact + " already exists");
                }
                else if (overwrite == OverwriteOption.AddNew)
                {
                    Logger.Info(coordinates + " already exist. Skipping upload.");
                    return(new List <MavenCoordinates>());
                }
            }

            return(new List <MavenCoordinates> {
                coordinates
            });;
        }
Пример #2
0
        private void Upload(Model.Project project, DirectoryInfo path, MavenCoordinates artifact)
        {
            var file        = new FileInfo(Path.Combine(path.FullName, artifact.ExpandedName));
            var artifactory = new Model.Artifact(artifact);
            var repo        = GetRepository(project, artifactory);

            repo.Upload(artifactory.Path, File.ReadAllBytes(file.FullName)).Run();
        }
Пример #3
0
        private void FindReplace(DirectoryInfo workspace, string oldName, string newName, MavenCoordinates coordinate)
        {
            var folder = Path.Combine(workspace.FullName, coordinate.FlatName);

            foreach (var file in Directory.GetFiles(folder))
            {
                FindReplaceInFileContent(file, oldName, newName);
            }
        }
Пример #4
0
 internal void ProvideDependency(string source, MavenCoordinates dependency)
 {
     Dependency.Provide(source, dependency);
 }
Пример #5
0
 internal void RequireDependency(string source, MavenCoordinates dependency)
 {
     Dependency.Require(source, dependency);
 }