簡體   English   中英

使用Maven運行可執行Jar

[英]Running an Executable Jar using Maven

是否可以使用Maven運行可執行的jar文件?

設置簡介:

  • 環境在Centos上運行
  • 我已經將exec插件包含到我的Maven POM中,並讓它運行一個Shell腳本,該腳本旨在運行jar文件,並且可以在終端上正常運行,但是在maven中運行時,我無法訪問jarfile錯誤。
  • 我將jar,shell和其他文件chmod設置為777
  • 我已經按照其他帖子的建議編輯了sudoers文件
  • 我還給了Maven和Jenkins根訪問權限

所有這些更改仍然會導致上述錯誤,我的想法已經用盡。

救命!!!

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