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
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * 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.

Author(s):
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.

Parameters:
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.

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