Estoy generando un jar con maven y me gustaría correrlo usando maven pero obtengo un error.
Esta es mi configuración del plugin en el pom:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<argument>-jar</argument>
<argument>target/farmacia-${project.version}-jar-with-depencencies.jar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
La cual la aprendí de stackoverflow.
Al correr el comando mvn install exec:exec -X
obtengo la ruta del jar mientras hace el install como
Building jar: C:\Users\ruslan.lopez\IdeaProjects\farmacia\target\farmacia-1.0-jar-with-dependencies.jar
Y la ejecución del exec me da la traza:
[DEBUG] (f) arguments = [-jar, target/farmacia-1.0-jar-with-depencencies.jar]
[DEBUG] (f) basedir = C:\Users\ruslan.lopez\IdeaProjects\farmacia
[DEBUG] (f) classpathScope = runtime
[DEBUG] (f) executable = java
[DEBUG] (f) failWithEmptyArgument = true
[DEBUG] (f) failWithNullKeyOrValueInEnvironment = true
[DEBUG] (f) longClasspath = false
[DEBUG] (f) project = MavenProject: xoxefdp.github.com:farmacia:1.0 @ C:\Users\ruslan.lopez\IdeaProjects\farmacia\pom.xml
[DEBUG] (f) skip = false
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@376e7531
[DEBUG] -- end configuration --
[DEBUG] Executing command line: [java, -jar, target/farmacia-1.0-jar-with-depencencies.jar]
Error: Unable to access jarfile target/farmacia-1.0-jar-with-depencencies.jar