Tuesday 15 January 2013

java - Passing 2 Arguments to Maven Exec Plugin - Only Recognizes as 1 Argument -



java - Passing 2 Arguments to Maven Exec Plugin - Only Recognizes as 1 Argument -

i have programme ran command line maven. programme takes 2 arguments, 1) name of properties file used , 2) name of test ran.

here exec plugin in pom:

<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.3.2</version> <configuration> <mainclass>com.sensus.test.chefdeploytest.testrunner</mainclass> </configuration> <executions> <execution> <goals> <goal>java</goal> </goals> <phase>package</phase> </execution> </executions> </plugin>

my main method:

public class testrunner { final static logger logger = logger.getlogger(testrunner.class); public static void main(string[] args) throws filenotfoundexception { if (args.length != 1){ logger.error("need location of properties file"); system.exit(0); } externalproperties.setlocation(args[0]); string testname = args[1]; junitcore core; result result = null; if (testname.equals("layer0")) { core = new junitcore(); result = core.run(layer0testrunner.class); }

here set in command line:

mvn bundle -dexec.args="test.properties layer0"

the problem: when this, sec argument of layer0 not recognized sec argument. instead, test.properties layer0 seen 1 argument. missing seen 2 arguments?

boy don't sense stupid, overlooked this:

if (args.length != 1)

no wonder wasn't recognizing them.

java maven arguments

No comments:

Post a Comment