4

I have an application developed in NetBeans/Maven that can be started via command line with:

mvn exec:exec "-Dexec.executable=C:\\Java\\jdk1.6.0_33\\bin\\java.exe" "-Dexec.args=-Dlog4j.properties=... -classpath %classpath com.xxx.MyLauncher" -Dexec.classpathScope=runtime -Dexec.workingdir=

Now I need to run the application through the standard java command line method, like:

java -Dlog4j.properties=... -jar myapp-1.2-SNAPSHOT.jar

Unfortunately this does not work in the same manner, as I get the following exception:

opencard.core.util.OpenCardPropertyLoadingException: property file not found

Questions:

  • What is the difference between launching applications with the Exec-Maven-plugin and the standard java execution on command line?
  • Is there an easy way to convert a Maven execution script to a standard command line?
  • How to run the application succesfully?
Peter Mularien
  • 2,578
  • 1
  • 25
  • 34
mistercaste
  • 236
  • 2
  • 4
  • does your jar include all the dependencies? see here for more info: [link](http://stackoverflow.com/questions/5107988/how-to-tell-maven-to-build-an-executable-jar) – Chris Snow Nov 13 '12 at 16:47
  • apparently on commandline you execute the jar as is it was executable, while in pom.xml you give it classpath and mainclass; did you check that your manifest entries match the executed commandline constructed by Maven ? – Petr Kozelka Nov 13 '12 at 16:48
  • It seems that the classpath was the problem, caused by this bug [ http://jira.codehaus.org/browse/MASSEMBLY-334]. Replacing the maven-assembly-plugin with maven-shade-plugin resolved the issue. Thanks for the support! – mistercaste Nov 14 '12 at 09:57

1 Answers1

1

The problem is the classpath, caused by this bug. Replacing the maven-assembly-plugin with maven-shade-plugin resolves the issue.

mistercaste
  • 236
  • 2
  • 4