eu.cedarsoft.devtools.modules.CreateMavenDirectoryStructureModule Maven / Gradle / Ivy
The newest version!
package eu.cedarsoft.devtools.modules;
import eu.cedarsoft.devtools.MavenMessageHandler;
import eu.cedarsoft.devtools.Module;
import eu.cedarsoft.utils.CmdLine;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.io.File;
/**
* Creates the maven directory structure for a default project
*/
public class CreateMavenDirectoryStructureModule implements Module {
@NotNull
@NonNls
private static final String SRC = "src";
@NotNull
@NonNls
private static final String MAIN = "main";
@NotNull
@NonNls
private static final String JAVA = "java";
@NotNull
@NonNls
private static final String RESOURCES = "resources";
@NotNull
@NonNls
private static final String TEST = "test";
public void process( @NotNull CmdLine cmdLine ) throws Exception {
cmdLine.out( MavenMessageHandler.get( "creating.dir.structure" ) );
File currentDir = new File( "." );
//src
File src = new File( currentDir, SRC );
src.mkdir();
//Main
File main = new File( src, MAIN );
main.mkdir();
new File( main, JAVA ).mkdir();
new File( main, RESOURCES ).mkdir();
File test = new File( src, TEST );
test.mkdir();
new File( test, JAVA ).mkdir();
new File( test, RESOURCES ).mkdir();
}
@NotNull
public String getDescription() {
return MavenMessageHandler.get( "module.create.dir.structure" );
}
}