add build script

master
yihua.huang 2013-11-12 11:14:15 +08:00
parent 81bb809dba
commit 4cd3e1d871
4 changed files with 8 additions and 2 deletions

View File

@ -0,0 +1,5 @@
#!/bin/sh
VERSION="0.4.1-SNAPTHOS"
mvn clean package
cp target/webmagic-scripts-${VERSION}.jar /usr/local/webmagic/webmagic-console.jar
rsync -avz --delete target/lib/ /usr/local/webmagic/lib/

View File

@ -105,6 +105,7 @@ public class ScriptConsole {
options.addOption(new Option("l", true, "language"));
options.addOption(new Option("t", true, "thread"));
options.addOption(new Option("f", true, "script file"));
options.addOption(new Option("s", true, "sleep time"));
CommandLineParser commandLineParser = new PosixParser();
CommandLine commandLine = commandLineParser.parse(options, args);
return readOptions(commandLine);

View File

@ -50,7 +50,7 @@ public class ScriptProcessor implements PageProcessor {
context.setAttribute("page", page, ScriptContext.ENGINE_SCOPE);
context.setAttribute("config", site, ScriptContext.ENGINE_SCOPE);
try {
engine.eval(defines + script, context);
engine.eval(defines + "\n" + script, context);
} catch (ScriptException e) {
e.printStackTrace();
}