我们正在使用spotify的dockerfile-maven-plugin。插件配置在下面,下面还有settings.xml代码片段。注意到,如果我们尝试使用设置-security.xml中配置的主密码加密密码,dockerfile-maven-plugin就会失败。问题是dockerfile-maven-plugin是否允许我们使用加密密码。
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.6</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>host:port/${project.artifactId}</repository>
<tag>${project.version}</tag>
<buildArgs>
<EAR_FILE>${project.build.finalName}.ear</EAR_FILE>
</buildArgs>
<useMavenSettingsForAuth>true</useMavenSettingsForAuth>
</configuration>
</plugin>settings-security.xml
<settingsSecurity>
<master>{Ve/ckepqKaIHGVED4WvoUn3htWLfPef158/35o9gdcM=}</master>
</settingsSecurity>settings.xml
<servers>
<server>
<id>host:port</id>
<username>zenDocker</username>
<password>{rdSNF21NPqMH70L7wKs1ZKg4nWF+8m+Hm3rFrpt/a+g=}</password>
</server>
</servers>发布于 2018-04-30 19:46:47
我也遇到了同样的问题,我通过使用maven扩展来解决这个问题:
<extension>
<groupId>com.github.shyiko.servers-maven-extension</groupId>
<artifactId>servers-maven-extension</artifactId>
<version>1.3.0</version>
</extension>我使用的参考资料:https://apexplained.wordpress.com/2015/08/08/password-encryption-in-the-liquibase-maven-plugin/
我的配置结果如下:
settings.xml
<server>
<id>hub.example.com</id>
<username>myUsername</username>
<password>{q6S7TmCyTP0H0q0IGOSsgnHSdbQlwXRcAF6h4Jvh/b0=}</password>
</server>pom.xml
<build>
<extensions>
<extension>
<groupId>com.github.shyiko.servers-maven-extension</groupId>
<artifactId>servers-maven-extension</artifactId>
<version>1.3.0</version>
</extension>
</extensions>
<plugins>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${com.spotify.dockerfile-maven-plugin.version}</version>
<configuration>
<repository>hub.example.com/${project.artifactId}</repository>
<useMavenSettingsForAuth>true</useMavenSettingsForAuth>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
</plugins>
发布于 2018-07-10 08:14:30
来自README.md (v1.4.3)的报价
从1.4.3版本开始,就支持在Maven设置文件中使用加密密码。有关在
settings.xml,请阅读这里的文档中加密服务器密码的详细信息。
发布于 2018-04-19 09:04:43
我遇到了同样的问题。根据https://github.com/spotify/dockerfile-maven/blob/master/plugin/src/main/java/com/spotify/plugin/dockerfile/MavenRegistryAuthSupplier.java#L50的代码和尝试错误练习,密码将以一个开放的形式出现。
return RegistryAuth.builder()
.username(server.getUsername())
.password(server.getPassword())
.build();https://stackoverflow.com/questions/48614768
复制相似问题