Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright (C) 2011 JFrog Ltd.
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
package org.jfrog.hudson.release.maven;
Rewrites the project versions in the pom.

Yossi Shaul
public class PomTransformer implements FilePath.FileCallable<Boolean> {
    private final String scmUrl;
    private final ModuleName currentModule;
    private final Map<ModuleNameStringversionsByModule;
    private final boolean failOnSnapshot;

Transforms single pom file.

currentModule The current module we work on
versionsByModule Map of module names to module version
scmUrl Scm url to use if scm element exists in the pom file
failOnSnapshot If true, fail with IllegalStateException if the pom contains snapshot version after the version changes
    public PomTransformer(ModuleName currentModuleMap<ModuleNameStringversionsByModuleString scmUrl,
            boolean failOnSnapshot) {
        this. = currentModule;
        this. = versionsByModule;
        this. = scmUrl;
        this. = failOnSnapshot;

Performs the transformation.

True if the file was modified.
    public Boolean invoke(File pomFileVirtualChannel channelthrows IOExceptionInterruptedException { current = new
        Map<, Stringmodules = Maps.newLinkedHashMap();
        for (Map.Entry<ModuleNameStringentry : .entrySet()) {
                    entry.getKey().entry.getKey().), entry.getValue());
        } transformer =
        return transformer.transform(pomFile);
New to GrepCode? Check out our FAQ X