That might be a dumb question but somehow I cannot figure it out (even with the lots of already given answers on stackoverflow) how to do it:
- I created a maven project
- I called
mvn package
and can execute the jar file withjava -jar
... and everything works fine. - After I deploy the jar into the remote repository, I want everyone in my team to be able to just call a maven command (like
mvn exec:java
or something like that) on the command line and Maven shall download the jar file from the remote repository and execute it.
Independent of the current directory in which the user is. How do I do that? Currently I get the error message that I need to be in a directory with an existing pom.xml file.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
</parent>
<groupId>handof.nod</groupId>
<artifactId>clirunnertest</artifactId>
<version>1.0</version>
<name>CLIRunnerTest</name>
<description>Kleines Testprogramm um zu testen wie Spring Boot auf der Command Line funktioniert</description>
<packaging>jar</packaging>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Package as an executable jar/war -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
<arguments>
<argument>-jar</argument>
<argument>target/clirunnertest-1.0.jar</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</project>