Home > Software design >  How to copy a file from private bitbucket repo with maven plugin
How to copy a file from private bitbucket repo with maven plugin

Time:07-27

I'm trying to download a file from a bitbucket repo as one of the build process steps on my local machine with response code 404. What I tried:

<build>
                <plugins>
                        <plugin>
                            <groupId>com.googlecode.maven-download-plugin</groupId>
                            <artifactId>download-maven-plugin</artifactId>
                            <version>1.6.8</version>
                            <executions>
                                <execution>
                                    <id>install-hereIAm</id>
                                    <phase>process-resources</phase>
                                    <goals>
                                        <goal>wget</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <username>{bitbucketUsername}</username>
                                <password>{bitbucketAppPassword}</password>
                                <uri>https://bitbucket.org/{user}/{repo}/raw/HEAD/somePath/hereIam</uri>
                                <outputFileName>findMe.txt</outputFileName>
                                <outputDirectory>${project.build.outputDirectory}/desired/path/</outputDirectory>
                            </configuration>
                        </plugin>
                </plugins>
            </build>

I found out, that WGET does not work also from my terminal, returning 404 e.g.:

$ wget -u {bitbucketUsername}:{bitbucketAppPassword} https://bitbucket.org/{user}/{repo}/raw/HEAD/somePath/hereIam

so I think I'm not authenticating my app correctly. Any thought on how to make this work is greatly appreciated.

CodePudding user response:

Just to finish this. I ended up with:

  1. downloading a file from bitbucket using exec-maven-plugin and git archive
  2. unpacking given archive using maven-antrun-plugin and ant untar task
  • Related