如何在 Jenkins Docker 的目录名称中使用带有重音符号的 Maven 程序集?
How to use Maven assembly with accent in directory name on Jenkins Docker?
我用maven-assembly-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
汇编文件:
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>rules</id>
<formats>
<format>jar</format>
</formats>
<baseDirectory>xxx-xxx-xxxFramework-rules</baseDirectory>
<fileSets>
<fileSet>
<outputDirectory></outputDirectory>
<directory>${basedir}</directory>
<excludes>
<exclude>target</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
我在 root
目录中有一个名为 règle
的文件夹。我使用 mvn clean deploy
。在我的 Windows 10 设备上,我的 jar 文件中的 règle
文件夹结果正常,但如果我在我的 Jenkins Unix Docker 上构建,我构建成功但没有我的文件夹命名règle
在我的最终 jar 文件中。
编辑 登录 Jenkins Docker:
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T18:29:23+01:00)
Maven home: /usr/local/share/maven
Java version: 1.8.0_191, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.10.0-1127.el7.x86_64", arch: "amd64", family: "unix"
编辑 2(在 Maven 命令上添加 -X):
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-assembly-plugin:2.6:single' with basic configurator -->
[DEBUG] (s) appendAssemblyId = true
[DEBUG] (f) attach = true
[DEBUG] (s) basedir = /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-xxxframework/xxx-xxx-xxxFramework-xxx
[DEBUG] (s) descriptor = assembly.xml
[DEBUG] (f) dryRun = false
[DEBUG] (f) encoding = Cp1252
编辑 3:
[DEBUG] (f) encoding = UTF-8
[DEBUG] All known ContainerDescriptorHandler components: [file-aggregator, metaInf-spring, plexus, metaInf-services]
[DEBUG] FileSet[] dir perms: -1 file perms: -1
[DEBUG] The archive base directory is 'null'
[DEBUG] NOT reformatting any files in /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-xxxframework/xxx-xxx-xxxFramework-rules/.
[DEBUG] Adding file-set in: /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-xxxframework/xxx-xxx-xxxFramework-rules/. to archive location: xxx-xxx-xxxFramework-rules/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/.settings/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/bom/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/ressources/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/ressources/xom-libraries/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/target/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/target/archive-tmp/
编辑 4:
我尝试添加这个但不起作用:
<fileMode>0755</fileMode>
<directoryMode>0755</directoryMode>
编辑 5:
我补充一下:
withMaven(globalMavenSettingsConfig: 'empty-global-settings', mavenSettingsConfig: Constants.CONFIG_SETTINGS_ID) {
sh "pwd"
sh "ls -lrt"
sh "ls -lrt /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-commonutility/xxx-xxx-CommonUtility-rules"
sh "ls -lrt /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-commonutility/xxx-xxx-CommonUtility-rules/règles"
sh "$MVN_CMD deploy -X"
}
我的结果是:
+ ls -lrt /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-commonutility/xxx-xxx-CommonUtility-rules
total 8
drwxr-xr-x. 2 jenkins root 125 Jul 15 21:32 bom
-rw-r--r--. 1 jenkins root 657 Jul 15 21:32 assembly.xml
drwxr-xr-x. 3 jenkins root 27 Jul 15 21:32 ressources
-rw-r--r--. 1 jenkins root 1492 Jul 15 21:32 pom.xml
drwxr-xr-x. 2 jenkins root 57 Jul 15 21:32 data
drwxr-xr-x. 3 jenkins root 23 Jul 15 21:32 règles
drwxr-xr-x. 3 jenkins root 82 Jul 15 21:32 target
[Pipeline] sh
+ ls -lrt $'/home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-commonutility/xxx-xxx-CommonUtility-rules/r30gles'
total 0
我将我的评论转换为答案:
问题似乎是Docker图像的奇怪编码:
platform encoding: ANSI_X3.4-1968
我用maven-assembly-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
汇编文件:
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<id>rules</id>
<formats>
<format>jar</format>
</formats>
<baseDirectory>xxx-xxx-xxxFramework-rules</baseDirectory>
<fileSets>
<fileSet>
<outputDirectory></outputDirectory>
<directory>${basedir}</directory>
<excludes>
<exclude>target</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>
我在 root
目录中有一个名为 règle
的文件夹。我使用 mvn clean deploy
。在我的 Windows 10 设备上,我的 jar 文件中的 règle
文件夹结果正常,但如果我在我的 Jenkins Unix Docker 上构建,我构建成功但没有我的文件夹命名règle
在我的最终 jar 文件中。
编辑 登录 Jenkins Docker:
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T18:29:23+01:00)
Maven home: /usr/local/share/maven
Java version: 1.8.0_191, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.10.0-1127.el7.x86_64", arch: "amd64", family: "unix"
编辑 2(在 Maven 命令上添加 -X):
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-assembly-plugin:2.6:single' with basic configurator -->
[DEBUG] (s) appendAssemblyId = true
[DEBUG] (f) attach = true
[DEBUG] (s) basedir = /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-xxxframework/xxx-xxx-xxxFramework-xxx
[DEBUG] (s) descriptor = assembly.xml
[DEBUG] (f) dryRun = false
[DEBUG] (f) encoding = Cp1252
编辑 3:
[DEBUG] (f) encoding = UTF-8
[DEBUG] All known ContainerDescriptorHandler components: [file-aggregator, metaInf-spring, plexus, metaInf-services]
[DEBUG] FileSet[] dir perms: -1 file perms: -1
[DEBUG] The archive base directory is 'null'
[DEBUG] NOT reformatting any files in /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-xxxframework/xxx-xxx-xxxFramework-rules/.
[DEBUG] Adding file-set in: /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-xxxframework/xxx-xxx-xxxFramework-rules/. to archive location: xxx-xxx-xxxFramework-rules/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/.settings/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/bom/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/ressources/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/ressources/xom-libraries/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/target/
[DEBUG] adding directory xxx-xxx-xxxFramework-rules/target/archive-tmp/
编辑 4:
我尝试添加这个但不起作用:
<fileMode>0755</fileMode>
<directoryMode>0755</directoryMode>
编辑 5:
我补充一下:
withMaven(globalMavenSettingsConfig: 'empty-global-settings', mavenSettingsConfig: Constants.CONFIG_SETTINGS_ID) {
sh "pwd"
sh "ls -lrt"
sh "ls -lrt /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-commonutility/xxx-xxx-CommonUtility-rules"
sh "ls -lrt /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-commonutility/xxx-xxx-CommonUtility-rules/règles"
sh "$MVN_CMD deploy -X"
}
我的结果是:
+ ls -lrt /home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-commonutility/xxx-xxx-CommonUtility-rules
total 8
drwxr-xr-x. 2 jenkins root 125 Jul 15 21:32 bom
-rw-r--r--. 1 jenkins root 657 Jul 15 21:32 assembly.xml
drwxr-xr-x. 3 jenkins root 27 Jul 15 21:32 ressources
-rw-r--r--. 1 jenkins root 1492 Jul 15 21:32 pom.xml
drwxr-xr-x. 2 jenkins root 57 Jul 15 21:32 data
drwxr-xr-x. 3 jenkins root 23 Jul 15 21:32 règles
drwxr-xr-x. 3 jenkins root 82 Jul 15 21:32 target
[Pipeline] sh
+ ls -lrt $'/home/jenkins/workspace/xxx_Common_xxxGenerate/xxx-xxx-commonutility/xxx-xxx-CommonUtility-rules/r30gles'
total 0
我将我的评论转换为答案:
问题似乎是Docker图像的奇怪编码:
platform encoding: ANSI_X3.4-1968