Reputation: 14970
My project has the following structure.
$tree
.
├── [4.0K] src/
│ └── [4.0K] main/
│ └── [4.0K] java/
│ └── [4.0K] org/
│ └── [4.0K] jfrog/
│ └── [4.0K] example/
│ └── [6.2K] ClientExample.java
├── [1.3K] pom.xml
└── [ 781] README.md
This is the sample program from
JFrog artifactory java client maven example
If I do mvn compile
I get the following output.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-example 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/karthik/Workspace/project-examples/artifactory-client-java-examples/maven-example/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ maven-example ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /home/karthik/Workspace/project-examples/artifactory-client-java-examples/maven-example/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.592 s
[INFO] Finished at: 2018-09-13T12:03:07+12:00
[INFO] Final Memory: 18M/135M
[INFO] ------------------------------------------------------------------------
followed by mvn package
INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building maven-example 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/karthik/Workspace/project-examples/artifactory-client-java-examples/maven-example/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ maven-example ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ maven-example ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/karthik/Workspace/project-examples/artifactory-client-java-examples/maven-example/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ maven-example ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven-example ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ maven-example ---
[INFO] Building jar: /home/karthik/Workspace/project-examples/artifactory-client-java-examples/maven-example/target/maven-example-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.751 s
[INFO] Finished at: 2018-09-13T12:04:30+12:00
[INFO] Final Memory: 12M/135M
[INFO] ------------------------------------------------------------------------
If I try to run the jar file generated.
java -jar target/maven-example-1.0-SNAPSHOT.jar
I get the following error.
no main manifest attribute, in target/maven-example-1.0-SNAPSHOT.jar
Since this is from JFrog github repository
I would expect it to work. What am I doing wrong?
Importing the project to IntelliJ IDE building and trying to run give the following results. Build looks successful (jar file gets generated inside target folder
)
However when I press run I get directed to the following page.
Upvotes: 0
Views: 1121
Reputation: 31269
The pom.xml
contains no instructions to build a runnable jar file. (And the README doesn't mention that you can run it like that)
The easiest way to run it is to import the project into your IDE (Eclipse, IntelliJ, etc.) that supports maven projects, and run the main class from there.
Upvotes: 1