0

My maven build uses unpack to extract some packages like zulu or postgres, which contain read-only files (e.g. -r-xr-xr-x pgsql/lib/libssl.so.1.0.0). When re-building, [WARNING] Unable to expand to file .../pgsql/lib/libssl.so.1.0.0 indicates that the file is not overwritten - which is OK as long as I don't switch versions (I'd still prefer to not have the warning then).

But how can I get unpack to overwrite the files if I switch to a newer postgres, for example? Or, if that is too complicated, always overwrite the files?

Note that the folders containing the readonly files are writable, so there is no technical reason for not overwriting the files (delete - create).

I would also prefer to keep read-only files read-only, assuming that the package-owners have had a reason.

On https://maven.apache.org/plugins/maven-dependency-plugin/unpack-mojo.html I found <overWriteIfNewer> which is true by default. As my build always tries to overwrite the files I think that overWrite is generally true, it just does not succeed.

For reference, here's the relevant part of my pom.xml

                        <id>unpack</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.postgresql</groupId>
                                    <artifactId>${postgresql.artifactId}</artifactId>
                                    <version>${postgresql.3rdparty.version}</version>
                                    <classifier>binaries</classifier>
                                    <type>tar.gz</type>
                                    <outputDirectory>${postgresql.install.folder}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
Bdot42
  • 11
  • 3

1 Answers1

0

Well, though not really an answer to the problem, I found out that the current behavior is due to Plexus Archiver just overwriting the file without deleting it if it exists. This means that the maven unpack extension does not handle well packages that contain read-only files. I need to clear the target folder and extract the packages on every (re-)build.

Bdot42
  • 11
  • 3