我正在使用 jenkins 构建一个 Maven 应用程序,该项目旨在运行一个 .jar 文件。它当前生成一个 .tar,其中包含一个以应用程序名称命名的 shell 文件。
我想知道是否可以替换自定义脚本生成的脚本。目前我可以实现的是将脚本包含在 tar 文件中:
<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/maven-v4_0_0.xsd">
<parent>
<artifactId>org-pom</artifactId>
<groupId>com.myOrg.org</groupId>
<version>1.14</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.myOrg.division.group</groupId>
<artifactId>myCurrentApplication</artifactId>
<version>1.0-SNAPSHOT</version>
<name>My Application</name>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appassembler-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<programs>
<program>
<mainClass>com.myOrg.division.group.MyMainClass</mainClass>
<name>myApplication</name>
</program>
</programs>
<platforms>
<platform>unix</platform>
</platforms>
<binFileExtensions>
<unix>.sh</unix>
</binFileExtensions>
</configuration>
<executions>
<execution>
<id>appassembly</id>
<phase>package</phase>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.myOrg.division.group.MyMainClass</mainClass>
</manifest>
</archive>
<descriptors>
<descriptor>src/assemble/bin.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
bin.xml 如下所示:
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<formats>
<format>tar</format>
</formats>
<baseDirectory>target/appassembler</baseDirectory>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>target/appassembler</directory>
<outputDirectory>myApplication</outputDirectory>
<fileMode>0755</fileMode>
<directoryMode>0755</directoryMode>
</fileSet>
<fileSet>
<directory>src/main</directory>
<outputDirectory>myApplication</outputDirectory>
<includes>
<include>conf/**</include>
<include>scripts/**</include>
</includes>
</fileSet>
</fileSets>
</assembly>
但是,这仅包括它们,而不是替换它们。是否可以将 myCustomShell.sh 而不是 myApplicationShell.sh 作为主脚本?
注意:我无法更改 jenkins 中的任何配置。
谢谢。