001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.maven.scm.plugin; 020 021import javax.inject.Inject; 022 023import java.io.IOException; 024 025import org.apache.maven.plugin.MojoExecutionException; 026import org.apache.maven.plugins.annotations.Mojo; 027import org.apache.maven.scm.ScmException; 028import org.apache.maven.scm.command.unedit.UnEditScmResult; 029import org.apache.maven.scm.manager.ScmManager; 030import org.apache.maven.scm.repository.ScmRepository; 031import org.apache.maven.settings.crypto.SettingsDecrypter; 032 033/** 034 * Unedit/unlock a set of files. 035 * 036 * @author <a href="dantran@apache.org">Dan Tran</a> 037 */ 038@Mojo(name = "unedit", aggregator = true) 039public class UnEditMojo extends AbstractScmMojo { 040 041 @Inject 042 public UnEditMojo(ScmManager manager, SettingsDecrypter settingsDecrypter) { 043 super(manager, settingsDecrypter); 044 } 045 046 /** {@inheritDoc} */ 047 public void execute() throws MojoExecutionException { 048 super.execute(); 049 050 try { 051 ScmRepository repository = getScmRepository(); 052 053 UnEditScmResult result = getScmManager().unedit(repository, getFileSet()); 054 055 checkResult(result); 056 } catch (IOException | ScmException e) { 057 throw new MojoExecutionException("Cannot run unedit command : ", e); 058 } 059 } 060}