Reputation: 4973
I have the following folder layout (built using maven deploy plugin):
projectrelease
├── README.md
└── com
└── example
└── demo
├── 0.0.1-SNAPSHOT
│ ├── demo-0.0.1-20171220.161043-1.jar
│ ├── demo-0.0.1-20171220.161043-1.jar.md5
│ ├── demo-0.0.1-20171220.161043-1.jar.sha1
│ ├── demo-0.0.1-20171220.161043-1.pom
│ ├── demo-0.0.1-20171220.161043-1.pom.md5
│ ├── demo-0.0.1-20171220.161043-1.pom.sha1
│ ├── maven-metadata.xml
│ ├── maven-metadata.xml.md5
│ └── maven-metadata.xml.sha1
├── maven-metadata.xml
├── maven-metadata.xml.md5
└── maven-metadata.xml.sha1
how can I run it using maven cmd?
the project was built using maven executable jar plugin and it can be run by:
./projectrelease/com/example/demo/0.0.1-SNAPSHOT/demo-0.0.1-20171220.161043-1.jar
or
java -jar projectrelease/com/example/demo/0.0.1-SNAPSHOT/demo-0.0.1-20171220.161043-1.jar
I'm looking to run a mvn cmd from the root folder so it will run the entire project
Upvotes: 0
Views: 68
Reputation: 18304
I'm looking to run a mvn cmd from the root folder so it will run the entire project
I don't think these files are runnable "per se" as they are, without some extra tool or Maven plugin. Also, I'm not actually sure what you mean by "run the project". Do you mean compile it? Or run it in some way similar to a normal java execution?
What you have there is the layout of complied Artifacts which belong in a Maven Repository.
Both Artifact and Repository are specific Maven concepts.
The .pom
and .xml
files, the .sha1
and .md5
files, are all metadata used by Maven itself to control downloads of the Artifact from a Repository. The .jar
file is the actual Artifact of interest.
These files are intended to be installed into a repo, and then used by other Maven projects by being referenced as a dependency in the pom.xml
.
For example:
<dependency>
<groupId>com.example.demo</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
The files can be installed in the "local repository" which is filesystem based, and is normally found at ${user.home}/.m2/
Or you can run a Repository server. Common Repository servers include Nexus, Artifactory or Archiva
The other possibility is that the main .jar
file is executable. In which case, you would run not with Maven, but as a normal Java file:
java -jar demo-0.0.1-20171220.161043-1.jar
Upvotes: 1