问题
i had a look at spring roo.I found that we can generate entities ,contollers and others using command prompt. But i need to get the entity names and field names as a user input from text boxes and then generate the project using roo. I am using windows.
回答1:
You can use the Roo Command Wizard available on the Springsource Tool Suite (STS).
回答2:
You can create script file, and then execute that file with roo.
>roo script --file fileName.
Unfortunaly I do not know if it is possible to run roo with the script as an parameter so that it automaticaly run that script.
回答3:
The latest roo (I have 2.0.0.BUILD-SNAPSHOT [rev 7a0fe1b]) has a fledgling web interface called Eastern Grey UI (http://localhost:9191). I'm finding you can call the functions like this (a test module I'm working on -- service.post just does a standard post to a web site):
Map<String, String> env = new HashMap<String, String>();
env.put("projectName", "clinic");
env.put("topLevelPackage", "com.ritchey");
String resp = service.post("http://localhost:9191/rs-api/project", env);
log.debug("resp = " + resp);
env = new HashMap<String, String>();
env.put("database", "MSSQL");
env.put("providerName", "HIBERNATE");
env.put("username", "Avatar");
env.put("password", "xxxxxx");
resp = service.post("http://localhost:9191/rs-api/persistence", env);
log.debug("resp = " + resp);
env = new HashMap<String, String>();
env.put("entityName", "~.domain.Pet");
resp = service.post("http://localhost:9191/rs-api/entities", env);
log.debug("resp = " + resp);
env = new HashMap<String, String>();
env.put("entityName", "~.domain.Pet");
env.put("fieldName", "name");
env.put("fieldGroup", "");
env.put("fieldType", "string");
env.put("referencedClass", "");
resp = service.post("http://localhost:9191/rs-api/fields", env);
log.debug("resp = " + resp);
来源:https://stackoverflow.com/questions/9322451/executing-spring-roo-programmatically