eu.cedarsoft.devtools.modules.InstallModule Maven / Gradle / Ivy
The newest version!
package eu.cedarsoft.devtools.modules;
import com.google.inject.Inject;
import eu.cedarsoft.devtools.CommandLineContext;
import eu.cedarsoft.devtools.MavenMessageHandler;
import eu.cedarsoft.devtools.MavenSupport;
import eu.cedarsoft.devtools.Module;
import eu.cedarsoft.devtools.ProcessWrapper;
import eu.cedarsoft.devtools.ModuleFailedException;
import eu.cedarsoft.utils.CmdLine;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
/**
* Installs a project
*/
public class InstallModule implements Module {
@NotNull
private final CommandLineContext commandLineContext;
@NotNull
private final MavenSupport mavenSupport;
@Inject
public InstallModule( @NotNull MavenSupport mavenSupport, @NotNull CommandLineContext commandLineContext ) {
this.mavenSupport = mavenSupport;
this.commandLineContext = commandLineContext;
}
@NotNull
public String getDescription() {
return MavenMessageHandler.get( "module.install.project" );
}
public void process( @NotNull CmdLine cmdLine ) throws IOException, ModuleFailedException {
cmdLine.out( MavenMessageHandler.get( "install.project" ) );
mavenSupport.ensurePomExists( new File( "." ) );
cmdLine.warning( MavenMessageHandler.get( "install.project" ) );
cmdLine.out( MavenMessageHandler.get( "with.projectId" ) );
@NonNls
String command = mavenSupport.getMavenBin() + " install -DperformRelease=true " + commandLineContext.getCmdLineArgs();
ProcessWrapper.runCommand( cmdLine, command );
cmdLine.success( MavenMessageHandler.get( "module.processed.successfully" ) );
}
}