Run mvn exec: exec without pom.xml

I am trying to find a way to just get the library from the maven repository and run it. I want to determine everything on the command line and ignore pom. I am doing my best:

 mvn exec:exec -Dexec.mainClass="org.main.Class" -Dspring.profiles.active=test

When I try to run it with pom.xml, it starts to extract all the dependencies described in pom. Which I really don't want. When I run it without pom.xml, it says Goal requires a project to execute but there is no POM in this directory. Please verify you invoked Maven from the correct directory.Is there a way to run it without pom or at least ignore it?

My goal is simply to run the application from any source without sources or jars.

+4
source share
2 answers

A possible workaround would be the following:

  • get the jar first
  • then do it

maven plugin dependency:get - pom.xml/project ( , )

mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get -DrepoUrl=https://dtp.intramundi.com/nexus/repository/maven-central/ -Dartifact=<group>:<artifact>:<version>

, , , dependency:copy-dependencies, pom.xml , , .

, a java -cp . yourArtifact.jar .

, , "exec:exec", pom.xml, :

  • pom.xml,
  • pom.xml , , : , "exec" .
+2

. . Mvn Exec - , , Maven Pluging, - maven-nature. Jar, java ***.jar?

0

Source: https://habr.com/ru/post/1692607/


All Articles