Package com.atlassian.maven.plugins.jgitflow.exception

Examples of com.atlassian.maven.plugins.jgitflow.exception.ProjectRewriteException


        String projectId = ArtifactUtils.versionlessKey(project.getGroupId(), project.getArtifactId());
        String releaseVersion = releaseVersions.get(projectId);
       
        if(Strings.isNullOrEmpty(releaseVersion))
        {
            throw new ProjectRewriteException("Release version for " + project.getName() + " was not found");
        }
       
        if(null == versionElement)
        {
            String parentVersion = null;
View Full Code Here


               
                artifactId = ReleaseUtil.interpolate(artifactIdElement.getTextTrim(),projectModel);
            }
            catch (ReleaseExecutionException e)
            {
                throw new ProjectRewriteException("error interpolating pom variable: " + e.getMessage(),e);
            }

            String artifactKey = ArtifactUtils.versionlessKey(groupId,artifactId);
            String mappedVersion = releaseVersions.get(artifactKey);
            String originalVersion = originalVersions.get(artifactKey);
           
            if(null != mappedVersion
                    && mappedVersion.endsWith(Artifact.SNAPSHOT_VERSION)
                    && !rawVersion.endsWith(Artifact.SNAPSHOT_VERSION)
                    && !updateDependencies)
            {
                continue;
            }
           
            if(null != mappedVersion)
            {
                if(rawVersion.equals(originalVersion))
                {
                    workLog.append(LF).append("updating ").append(artifactId).append(" to ").append(mappedVersion);
                    versionElement.setText(mappedVersion);
                    modified = true;
                }
                else if(rawVersion.matches("\\$\\{.+\\}"))
                {
                    String propName = rawVersion.substring(2,rawVersion.length() - 1);
                   
                    if(propName.startsWith("project.")
                            || propName.startsWith("pom.")
                            || "version".equals(propName)
                            )
                    {
                        if(!mappedVersion.equals(releaseVersions.get(projectId)))
                        {
                            workLog.append(LF).append("updating ").append(artifactId).append(" to ").append(mappedVersion);
                            versionElement.setText(mappedVersion);
                            modified = true;
                        }
                    }
                    else if(null != properties)
                    {
                        Element prop = properties.getChild(propName, properties.getNamespace());
                        if(null != prop)
                        {
                            String propValue = prop.getTextTrim();
                            if(propValue.equals(originalVersion))
                            {
                                workLog.append(LF).append("updating ").append(rawVersion).append(" to ").append(mappedVersion);
                                prop.setText(mappedVersion);
                                modified = true;
                            }
                            else if(!mappedVersion.equals(rawVersion))
                            {
                                if(!mappedVersion.matches("\\$\\{project.+\\}")
                                        && !mappedVersion.matches("\\$\\{pom.+\\}")
                                        && !"${version}".equals(mappedVersion))
                                {
                                    throw new ProjectRewriteException("The artifact (" + artifactKey + ") requires a "
                                            + "different version (" + mappedVersion + ") than what is found ("
                                            + propValue + ") for the expression (" + propName + ") in the "
                                            + "project (" + projectId + ").");
                                }
                            }
                        }
                        else
                        {
                            throw new ProjectRewriteException("Error updating version '" + rawVersion + "' for artifact " + artifactKey);
                        }
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of com.atlassian.maven.plugins.jgitflow.exception.ProjectRewriteException

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.