Can't run Traccar buit form source outside of Netbeans

gustavofarias5 years ago

When I run it on Netbeans everything works and the console shows these commands:

cd D:\Users\username\Desktop\traccar; "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_51" cmd /c """C:\Program Files\NetBeans 8.2\java\maven\bin\mvn.bat" -Dexec.args="-classpath %classpath org.traccar.Main debug.xml" -Dexec.executable="C:\Program Files\Java\jdk1.8.0_51\bin\java.exe" -Dmaven.ext.class.path="C:\Program Files\NetBeans 8.2\java\maven-nblib\netbeans-eventspy.jar" -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec""

So I tried to reproduce what Netbeans do this way:

  • created environment variable "JAVA_HOME" with value "C:\Program Files\Java\jdk1.8.0_51"
  • created file "run.bat" and put it in "D:\Users\username\Desktop\traccar"
  • put this content in it:

"C:\Program Files\NetBeans 8.2\java\maven\bin\mvn.bat" -Dexec.args="-classpath %classpath org.traccar.Main debug.xml" -Dexec.executable="C:\Program Files\Java\jdk1.8.0_51\bin\java.exe" -Dmaven.ext.class.path="C:\Program Files\NetBeans 8.2\java\maven-nblib\netbeans-eventspy.jar" -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec

Basically I removed the " and \ because they were causing errors. Unfortunately I get this:

[INFO] Building traccar 3.9-SNAPSHOT
...
[INFO] BUILD FAILURE
...
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project traccar: The parameters 'executable' for goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec are missing or invalid -> [Help 1]
Anton Tananaev5 years ago

All you need to do is use following maven command:

mvn package
gustavofarias5 years ago

mvn package made the build. But now I need to run the server.

Anton Tananaev5 years ago

It's a regular Java application. You just need to provide a path to the config file as a command line argument.

gustavofarias5 years ago

Sorry for asking this very basic stuff, but the Build from source section is quite silent about how to run after you build.

Anyway, I was able to run with java -jar target/tracker-server.jar. Running "tracker-server-jar-with-dependencies.jar" seems to have the same effect.

Thanks for the reply and the great work.

Anton Tananaev5 years ago

Just make sure you pass config file as a command line argument.

Gantz5 years ago

sorry for this basic question but how do i pass the config file as a command line argument?

Thanks

Anton Tananaev5 years ago

Like this:

java -jar target/tracker-server.jar /path/to/config/traccar.xml