-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
To Run Maven Project #8
Comments
@pritip123 thanks for asking. Until now I've always been compiling my simple Java application with BTW, if you can, it would help if you could share your maven application with us so that we can play with it directly. If this is not possible, then no problem, we will create our own small application. |
@pritip123 did you perhaps package the jar with dependencies? Check if your maven build configuration looks something like this:
|
Hello @pritip123, we've been playing with following Java application that makes use of some external dependencies: package org.xlab;
import org.apache.commons.io.output.StringBuilderWriter;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
StringBuilderWriter sbw = new StringBuilderWriter();
sbw.append("Hello");
sbw.append(" ");
sbw.append("world");
System.out.println(sbw.toString());
}
} We then used Maven to build a fat jar by using the snippet that @gasper-vrhovsek kindly provided in the comment above. The result was a
The content of the two meta files was as follows: # meta/package.yaml
name: demo
title: Maven Demo
author: me # meta/run.yaml
runtime: java
config_set:
hello:
jvm_args:
- "-jar"
main: /osv_sample-1.0-SNAPSHOT-jar-with-dependencies.jar
classpath:
- /
config_set_default: hello Then I $ cd demo
$ capstan package compose demo --pull-missing
$ capstan run demo --boot hello
Command line will be set based on --boot parameter
Created instance: demo
Setting cmdline: runscript /run/hello
OSv v0.24-434-gf4d1dfb
eth0: 192.168.122.15
java.so: Starting JVM app using: io/osv/nonisolated/RunNonIsolatedJvmApp
java.so: Setting Java system classloader to NonIsolatingOsvSystemClassLoader
Hello world Most probably you were using the incorrect parameters inside |
Thanks a lot @gasper-vrhovsek and @miha-plesko . I was not adding jvm_args as jar file and so its always looking for the main class instead of jar file .Its working fine now. |
I have a Java with Maven project with all dependencies ,I have done mvn package and trying to run the main class but it could not able to resolve the dependencies can you please provide the steps to run the maven project with all dependencies.
The text was updated successfully, but these errors were encountered: