简体   繁体   English

使用Maven运行可执行Jar

[英]Running an Executable Jar using Maven

Is it possible to run an executable jar file using Maven? 是否可以使用Maven运行可执行的jar文件?

A brief introduction to setup: 设置简介:

  • Environment is running on Centos 环境在Centos上运行
  • I have included the exec plugin into my maven POM and have it running a shell script that is meant to run the jar file and works fine using the terminal but I get Unable to access jarfile error when run in maven. 我已经将exec插件包含到我的Maven POM中,并让它运行一个Shell脚本,该脚本旨在运行jar文件,并且可以在终端上正常运行,但是在maven中运行时,我无法访问jarfile错误。
  • I have chmod the jar, shell and other files to 777 我将jar,shell和其他文件chmod设置为777
  • I have editted the sudoers file as suggested by other posts 我已经按照其他帖子的建议编辑了sudoers文件
  • I have also given maven and Jenkins root access 我还给了Maven和Jenkins根访问权限

All of these changes still result in the above error and I have run out of ideas. 所有这些更改仍然会导致上述错误,我的想法已经用尽。

HELP!!! 救命!!!

POM File POM文件

 <pluginRepositories>
<pluginRepository>
<id>smartbear-sweden-plugin-repository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<!--  Run our Password Checker script  -->
<id>Password Checker</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>src/pass/passCheck.sh</executable>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>4.5.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>test</goal>
</goals>
<id>MPesa-Tests</id>
<configuration>
<projectFile>src/test/GenericAPI-G2-soapui-project.xml</projectFile>
<outputFolder>SoapUI-Results/</outputFolder>
<junitReport>true</junitReport>
<exportwAll>true</exportwAll>
<printReport>false</printReport>
<projectProperties>
<value>message=Tests Completed</value>
</projectProperties>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<configuration>
<outputDirectory>/usr/share/Surefire/</outputDirectory>
<reportDirectories>
<reportDirectories>/usr/share/Surefire/reports/</reportDirectories>
</reportDirectories>
</configuration>
</plugin>
</plugins>
</build>
</project>

我有完全相同的需求来执行Spring Boot打包的应用程序,并通过使用maven依赖插件将工件复制到/ tmp(或任何地方)来解决它,然后使用maven exec插件通过exec执行该jar。 :exec目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM