eu.cedarsoft.devtools.modules.FastInstallModule 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 the module fast - without tests and without creating sources.
*/
public class FastInstallModule implements Module {
@NotNull
private final MavenSupport mavenSupport;
@NotNull
private final CommandLineContext commandLineContext;
@Inject
public FastInstallModule( @NotNull MavenSupport mavenSupport, @NotNull CommandLineContext commandLineContext ) {
this.mavenSupport = mavenSupport;
this.commandLineContext = commandLineContext;
}
@NotNull
public String getDescription() {
return MavenMessageHandler.get( "module.fast.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" ) );
@NonNls
String command = mavenSupport.getMavenBin() + " install -Dmaven.test.skip=true -o " + commandLineContext.getCmdLineArgs();
ProcessWrapper.runCommand( cmdLine, command );
cmdLine.success( MavenMessageHandler.get( "module.processed.successfully" ) );
}
}