How to copy unversioned test resources during release:perform?

假装没事ソ 提交于 2019-12-02 10:07:41
Markus Malkusch

There seems to be many ways to achieve this. One way is with the maven-resources-plugin and a profile. The release-plugin sets during release:perform the profile release-plugin. You simply have add the maven-resources-plugin into that profile (or a custom profile which is activated by <releaseProfiles>).

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.6</version>
    <executions>
        <execution>
            <id>copy-resources</id>
            <phase>validate</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
                <resources>
                    <resource>
                        <directory>${basedir}/../../src/test/resources/</directory>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>

With org.sonatype.oss:oss-parent it's a bit different, as that parent disables <useReleaseProfile> but uses sonatype-oss-release.

Just as a quick reply :

You SHOULD not include unversionned resources. This is not Maven philisophy ... indeed you MUST not :).

and aimed to provide repeatable build. You CANNOT ensure that your build will ever deliver the same result if you rely on unversioned, let say uncontroled, resources.

For later purposes, credentials can be encrypted easily :

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!